Documentation
¶
Index ¶
- Constants
- type ConnAck
- type ConnAckProperties
- type Connect
- type ConnectOptions
- type ConnectProperties
- type Disconnect
- type DisconnectProperties
- type Packet
- type PingReq
- type PingRes
- type PubAck
- type PubAckPacket
- type PubAckProperties
- type PubComp
- type PubPacket
- type PubRec
- type PubRel
- type Publish
- type PublishOptions
- type PublishProperties
- type SubAck
- type SubAckProperties
- type Subscribe
- type SubscribeProperties
- type Subscription
- type UnSubAck
- type UnSubAckProperties
- type UnSubscribe
- type UnSubscribeProperties
- type UserProperty
- type WillProperties
Constants ¶
View Source
const ( ConnackSuccess = 0x00 ConnackUnspecifiedError = 0x80 ConnackMalformedPacket = 0x81 ConnackProtocolError = 0x82 ConnackImplementationError = 0x83 ConnackUnsupportedProtocolVersion = 0x84 ConnackClientIdentifierNotValid = 0x85 ConnackBadUsernameOrPassword = 0x86 ConnackNotAuthorized = 0x87 ConnackServerBusy = 0x89 ConnackBanned = 0x8A ConnackBadAuthenticationMethod = 0x8C ConnackTopicNameInvalid = 0x90 ConnackPacketToLarge = 0x95 ConnackQuotaExceeded = 0x97 ConnackPayloadFormatInvalid = 0x99 ConnackRetainNotSupported = 0x9A ConnackQosNotSupported = 0x9B ConnackUseAnotherServer = 0x9C ConnackServerMoved = 0x9D ConnackConnectionRateExceeded = 0x9F )
View Source
const ( FlagCleanStart = 0x02 FlagWillFlag = 0x04 FlagWillRetain = 0x20 FlagPassword = 0x40 FlagUsername = 0x80 FlagWillQoSShift = 3 )
View Source
const ( DisconnectNormalDisconnection = 0x00 DisconnectDisconnectWithWillMessage = 0x04 DisconnectUnspecifiedError = 0x80 DisconnectMalformedPacket = 0x81 DisconnectProtocolError = 0x82 DisconnectImplementationSpecificError = 0x83 DisconnectNotAuthorized = 0x87 DisconnectServerBusy = 0x89 DisconnectServerShuttingDown = 0x8B DisconnectKeepAliveTimeout = 0x8D DisconnectSessionTakenOver = 0x8E DisconnectTopicFilterInvalid = 0x8F DisconnectTopicNameInvalid = 0x90 DisconnectReceiveMaximumExceeded = 0x93 DisconnectTopicAliasInvalid = 0x94 DisconnectPacketTooLarge = 0x95 DisconnectMessageRateTooHigh = 0x96 DisconnectQuotaExceeded = 0x97 DisconnectAdministrativeAction = 0x98 DisconnectPayloadFormatInvalid = 0x99 DisconnectRetainNotSupported = 0x9A DisconnectQoSNotSupported = 0x9B DisconnectUseAnotherServer = 0x9C DisconnectServerMoved = 0x9D DisconnectConnectionRateExceeded = 0x9F DisconnectMaximumConnectTime = 0xA0 DisconnectSubscriptionIdentifiersNotSupported = 0xA1 DisconnectWildcardSubscriptionsNotSupported = 0xA2 )
View Source
const ( TypeConnect byte TypeConnack TypePublish TypePubAck TypePubRec TypePubRel TypePubComp TypeSubscribe TypeSubAck TypeUnsubscribe TypeUnSubAck TypePingReq TypePingResp TypeDisconnect TypeAuth )
View Source
const ( PropertyPayloadFormatIndicator = 0x01 PropertyMessageExpiryInterval = 0x02 PropertyContentType = 0x03 PropertyResponseTopic = 0x08 PropertyCorrelationData = 0x09 PropertySubscriptionIdentifier = 0x0B PropertySessionExpiryInterval = 0x11 PropertyAssignedClientIdentifier = 0x12 PropertyServerKeepAlive = 0x13 PropertyAuthenticationMethod = 0x15 PropertyAuthenticationData = 0x16 PropertyRequestProblemInfo = 0x17 PropertyWillDelayInterval = 0x18 PropertyRequestResponseInfo = 0x19 PropertyResponseInformation = 0x1A PropertyServerReference = 0x1C PropertyReasonString = 0x1F PropertyReceiveMaximum = 0x21 PropertyTopicAliasMaximum = 0x22 PropertyTopicAlias = 0x23 PropertyMaximumQoS = 0x24 PropertyRetainAvailable = 0x25 PropertyUserProperty = 0x26 PropertyMaximumPacketSize = 0x27 PropertyWildcardSubscriptionAvailable = 0x28 PropertySubscriptionIdentifierAvailable = 0x29 )
View Source
const ( PubQosStepSuccess = 0x00 PubQosStepPackedIDNotFound = 0x92 )
View Source
const ( FlagRetain = 0x01 FlagDup = 0x08 )
View Source
const ( PubAckSuccess = 0x00 PubAckNoMatchingSubscriber = 0x10 PubAckUnspecifiedError = 0x80 PubAckImplementationSpecificError = 0x83 PubAckNotAuthorized = 0x87 PubAckTopicNameInvalid = 0x90 PubAckPacketIdentifierInUse = 0x91 PubAckPacketIdentifierNotFound = 0x92 PubAckQuotaExceed = 0x97 PubAckPayloadFormatInvalid = 0x99 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnAck ¶
type ConnAck struct {
SessionPresent bool
ReasonCode byte
Properties *ConnAckProperties
}
type ConnAckProperties ¶
type ConnAckProperties struct {
SessionExpiryInterval *uint32
ReceiveMaximum *uint16
MaximumQoS *byte
RetainAvailable *byte
MaximumPacketSize *uint32
AssignedClientIdentifier string
TopicAliasMaximum *uint16
ReasonString string
UserProperty []UserProperty
WildcardSubscriptionAvailable *byte
SubscriptionIdentifierAvailable *byte
ServerKeepAlive *uint16
ResponseInformation string
ServerReference string
AuthenticationMethod string
AuthenticationData []byte
}
func (*ConnAckProperties) LogValue ¶
func (pp *ConnAckProperties) LogValue() slog.Value
type Connect ¶
type Connect struct {
// contains filtered or unexported fields
}
func NewConnect ¶
func NewConnect(opt ConnectOptions) *Connect
type ConnectOptions ¶
type ConnectProperties ¶
type ConnectProperties struct {
SessionExpiryInterval *uint32
ReceiveMaximum *uint16
MaximumPacketSize *uint32
TopicAliasMaximum *uint16
RequestResponseInformation *byte
RequestProblemInformation *byte
UserProperty []UserProperty
AuthenticationMethod string
AuthenticationData []byte
}
func (*ConnectProperties) Encode ¶
func (cp *ConnectProperties) Encode() ([]byte, error)
func (*ConnectProperties) LogValue ¶
func (cp *ConnectProperties) LogValue() slog.Value
type Disconnect ¶
type Disconnect struct {
ReasonCode byte
Properties *DisconnectProperties
}
func NewDisconnect ¶
func NewDisconnect(reasonCode byte, properties *DisconnectProperties) *Disconnect
type DisconnectProperties ¶
type DisconnectProperties struct {
SessionExpiryInterval *uint32
ReasonString string
UserProperty []UserProperty
ServerReference string
}
func (*DisconnectProperties) Encode ¶
func (dp *DisconnectProperties) Encode() ([]byte, error)
type PubAck ¶
type PubAck struct {
PubAckPacket
}
type PubAckPacket ¶
type PubAckPacket struct {
PacketID uint16
ReasonCode byte
Properties *PubAckProperties
}
func (*PubAckPacket) GetPacketID ¶
func (ap *PubAckPacket) GetPacketID() uint16
func (*PubAckPacket) SetPacketID ¶
func (ap *PubAckPacket) SetPacketID(packetID uint16)
type PubAckProperties ¶
type PubAckProperties struct {
ReasonString string
UserProperty []UserProperty
}
func (*PubAckProperties) Encode ¶
func (ap *PubAckProperties) Encode() ([]byte, error)
type PubComp ¶
type PubComp struct {
PubAckPacket
}
type PubRec ¶
type PubRec struct {
PubAckPacket
}
type PubRel ¶
type PubRel struct {
PubAckPacket
}
type Publish ¶
type Publish struct {
// contains filtered or unexported fields
}
func NewPublish ¶
func NewPublish(opt PublishOptions) (*Publish, error)
func (*Publish) GetPacketID ¶
func (*Publish) MarkAsDuplicated ¶
func (p *Publish) MarkAsDuplicated()
func (*Publish) Properties ¶
func (p *Publish) Properties() *PublishProperties
func (*Publish) SetPacketID ¶
type PublishOptions ¶
type PublishOptions struct {
Qos byte
Retain bool
Topic string
PublishProperties *PublishProperties
Payload []byte
}
type PublishProperties ¶
type PublishProperties struct {
PayloadFormatIndicator *bool
MessageExpiryInterval *uint32
TopicAlias *uint16
ResponseTopic string
CorrelationData []byte
UserProperty []UserProperty
SubscriptionIdentifier *uint32
ContentType string
}
func (*PublishProperties) Encode ¶
func (pp *PublishProperties) Encode() ([]byte, error)
type SubAck ¶
type SubAck struct {
PacketID uint16
Properties *SubAckProperties
ReasonCodes []byte
}
type SubAckProperties ¶
type SubAckProperties struct {
ReasonString string
UserProperty []UserProperty
}
type Subscribe ¶
type Subscribe struct {
PacketID uint16
Subscriptions []Subscription
SubscribeProperties *SubscribeProperties
}
type SubscribeProperties ¶
type SubscribeProperties struct {
SubscriptionIdentifier *uint32
UserProperty []UserProperty
}
func (*SubscribeProperties) Encode ¶
func (sp *SubscribeProperties) Encode() ([]byte, error)
type Subscription ¶
type UnSubAck ¶
type UnSubAck struct {
PacketID uint16
Properties *UnSubAckProperties
ReasonCodes []byte
}
type UnSubAckProperties ¶
type UnSubAckProperties struct {
ReasonString string
UserProperty []UserProperty
}
type UnSubscribe ¶
type UnSubscribe struct {
PacketID uint16
TopicFilters []string
UnSubscribeProperties *UnSubscribeProperties
}
type UnSubscribeProperties ¶
type UnSubscribeProperties struct {
UserProperty []UserProperty
}
Note: `UserProperty` could be a direct property in `UnSubscribe`, since `UnSubscribeProperties` has only one property. However, I prefer code consistency and easier extensibility if the spec changes.
func (*UnSubscribeProperties) Encode ¶
func (sp *UnSubscribeProperties) Encode() ([]byte, error)
type UserProperty ¶
type UserProperty struct {
Key, Value string
}
type WillProperties ¶
type WillProperties struct {
WillDelayInterval *uint32
PayloadFormatIndicator *bool
MessageExpiryInterval *uint32
ContentType string
ResponseTopic string
CorrelationData []byte
UserProperty []UserProperty
}
func (*WillProperties) Encode ¶
func (wp *WillProperties) Encode() ([]byte, error)
func (*WillProperties) LogValue ¶
func (wp *WillProperties) LogValue() slog.Value
Click to show internal directories.
Click to hide internal directories.