Versions in this module Expand all Collapse all v1 v1.0.0 Sep 7, 2022 Changes in this version + const AUTH + const CONNACK + const CONNECT + const DISCONNECT + const FlagPubrel + const FlagReserved + const FlagSubscribe + const FlagUnsubscribe + const PINGREQ + const PINGRESP + const PUBACK + const PUBCOMP + const PUBLISH + const PUBREC + const PUBREL + const PropAssignedClientID + const PropAuthData + const PropAuthMethod + const PropContentType + const PropCorrelationData + const PropMaximumPacketSize + const PropMaximumQoS + const PropMessageExpiry + const PropPayloadFormat + const PropReasonString + const PropReceiveMaximum + const PropRequestProblemInfo + const PropRequestResponseInfo + const PropResponseInfo + const PropResponseTopic + const PropRetainAvailable + const PropServerKeepAlive + const PropServerReference + const PropSessionExpiryInterval + const PropSharedSubAvailable + const PropSubIDAvailable + const PropSubscriptionIdentifier + const PropTopicAlias + const PropTopicAliasMaximum + const PropUser + const PropWildcardSubAvailable + const PropWillDelayInterval + const Qos0 + const Qos1 + const Qos2 + const RESERVED + const SUBACK + const SUBSCRIBE + const SubscribeFailure + const UNSUBACK + const UNSUBSCRIBE + var ErrInvalUTF8String = errors.New("invalid utf-8 string") + var ValidProperties = map[byte]map[byte]struct + func DecodeRemainLength(length int) ([]byte, error) + func DecodeUTF8String(buf []byte) (b []byte, size int, err error) + func EncodeRemainLength(r io.ByteReader) (int, error) + func EncodeUTF8String(buf []byte) (b []byte, size int, err error) + func IsVersion3X(v Version) bool + func IsVersion5(v Version) bool + func TopicMatch(topic []byte, topicFilter []byte) bool + func TotalBytes(p Packet) uint32 + func ValidTopicFilter(mustUTF8 bool, p []byte) bool + func ValidTopicName(mustUTF8 bool, p []byte) bool + func ValidUTF8(p []byte) bool + func ValidV5Topic(p []byte) bool + func ValidateCode(packType byte, code byte) bool + func ValidateID(packetType byte, i byte) bool + type Auth struct + Code byte + FixHeader *FixHeader + Properties *Properties + func NewAuthPacket(fh *FixHeader, r io.Reader) (*Auth, error) + func (a *Auth) Pack(w io.Writer) error + func (a *Auth) String() string + func (a *Auth) Unpack(r io.Reader) error + type Connack struct + Code codes.Code + FixHeader *FixHeader + Properties *Properties + SessionPresent bool + Version Version + func NewConnackPacket(fh *FixHeader, version Version, r io.Reader) (*Connack, error) + func (c *Connack) Pack(w io.Writer) error + func (c *Connack) String() string + func (c *Connack) Unpack(r io.Reader) error + type Connect struct + CleanStart bool + ClientID []byte + FixHeader *FixHeader + KeepAlive uint16 + Password []byte + PasswordFlag bool + Properties *Properties + ProtocolLevel byte + ProtocolName []byte + Username []byte + UsernameFlag bool + Version Version + WillFlag bool + WillMsg []byte + WillProperties *Properties + WillQos uint8 + WillRetain bool + WillTopic []byte + func NewConnectPacket(fh *FixHeader, version Version, r io.Reader) (*Connect, error) + func (c *Connect) NewConnackPacket(code codes.Code, sessionReuse bool) *Connack + func (c *Connect) Pack(w io.Writer) error + func (c *Connect) String() string + func (c *Connect) Unpack(r io.Reader) (err error) + type Disconnect struct + Code codes.Code + FixHeader *FixHeader + Properties *Properties + Version Version + func NewDisConnectPackets(fh *FixHeader, version Version, r io.Reader) (*Disconnect, error) + func (d *Disconnect) Pack(w io.Writer) error + func (d *Disconnect) String() string + func (d *Disconnect) Unpack(r io.Reader) error + type FixHeader struct + Flags byte + PacketType byte + RemainLength int + func (fh *FixHeader) Pack(w io.Writer) error + type MockPacket struct + func NewMockPacket(ctrl *gomock.Controller) *MockPacket + func (m *MockPacket) EXPECT() *MockPacketMockRecorder + func (m *MockPacket) Pack(w io.Writer) error + func (m *MockPacket) String() string + func (m *MockPacket) Unpack(r io.Reader) error + type MockPacketMockRecorder struct + func (mr *MockPacketMockRecorder) Pack(w interface{}) *gomock.Call + func (mr *MockPacketMockRecorder) String() *gomock.Call + func (mr *MockPacketMockRecorder) Unpack(r interface{}) *gomock.Call + type Packet interface + Pack func(w io.Writer) error + String func() string + Unpack func(r io.Reader) error + func NewPacket(fh *FixHeader, version Version, r io.Reader) (Packet, error) + type PacketID = uint16 + const MaxPacketID + const MinPacketID + type PayloadFormat = byte + const PayloadFormatBytes + const PayloadFormatString + type Pingreq struct + FixHeader *FixHeader + func NewPingreqPacket(fh *FixHeader, r io.Reader) (*Pingreq, error) + func (p *Pingreq) NewPingresp() *Pingresp + func (p *Pingreq) Pack(w io.Writer) error + func (p *Pingreq) String() string + func (p *Pingreq) Unpack(r io.Reader) error + type Pingresp struct + FixHeader *FixHeader + func NewPingrespPacket(fh *FixHeader, r io.Reader) (*Pingresp, error) + func (p *Pingresp) Pack(w io.Writer) error + func (p *Pingresp) String() string + func (p *Pingresp) Unpack(r io.Reader) error + type Properties struct + AssignedClientID []byte + AuthData []byte + AuthMethod []byte + ContentType []byte + CorrelationData []byte + MaximumPacketSize *uint32 + MaximumQoS *byte + MessageExpiry *uint32 + PayloadFormat *byte + ReasonString []byte + ReceiveMaximum *uint16 + RequestProblemInfo *byte + RequestResponseInfo *byte + ResponseInfo []byte + ResponseTopic []byte + RetainAvailable *byte + ServerKeepAlive *uint16 + ServerReference []byte + SessionExpiryInterval *uint32 + SharedSubAvailable *byte + SubIDAvailable *byte + SubscriptionIdentifier []uint32 + TopicAlias *uint16 + TopicAliasMaximum *uint16 + User []UserProperty + WildcardSubAvailable *byte + WillDelayInterval *uint32 + func (p *Properties) Pack(bufw *bytes.Buffer, packetType byte) + func (p *Properties) PackWillProperties(bufw *bytes.Buffer) + func (p *Properties) String() string + func (p *Properties) Unpack(bufr *bytes.Buffer, packetType byte) error + func (p *Properties) UnpackWillProperties(bufr *bytes.Buffer) error + type Puback struct + Code codes.Code + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + Version Version + func NewPubackPacket(fh *FixHeader, version Version, r io.Reader) (*Puback, error) + func (p *Puback) Pack(w io.Writer) error + func (p *Puback) String() string + func (p *Puback) Unpack(r io.Reader) error + type Pubcomp struct + Code byte + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + Version Version + func NewPubcompPacket(fh *FixHeader, version Version, r io.Reader) (*Pubcomp, error) + func (p *Pubcomp) Pack(w io.Writer) error + func (p *Pubcomp) String() string + func (p *Pubcomp) Unpack(r io.Reader) error + type Publish struct + Dup bool + FixHeader *FixHeader + Payload []byte + Properties *Properties + Qos uint8 + Retain bool + TopicName []byte + Version Version + func NewPublishPacket(fh *FixHeader, version Version, r io.Reader) (*Publish, error) + func (p *Publish) NewPuback(code codes.Code, ppt *Properties) *Puback + func (p *Publish) NewPubrec(code codes.Code, ppt *Properties) *Pubrec + func (p *Publish) Pack(w io.Writer) error + func (p *Publish) String() string + func (p *Publish) Unpack(r io.Reader) error + type Pubrec struct + Code byte + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + Version Version + func NewPubrecPacket(fh *FixHeader, version Version, r io.Reader) (*Pubrec, error) + func (p *Pubrec) NewPubrel() *Pubrel + func (p *Pubrec) Pack(w io.Writer) error + func (p *Pubrec) String() string + func (p *Pubrec) Unpack(r io.Reader) error + type Pubrel struct + Code codes.Code + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + func NewPubrelPacket(fh *FixHeader, r io.Reader) (*Pubrel, error) + func (p *Pubrel) NewPubcomp() *Pubcomp + func (p *Pubrel) Pack(w io.Writer) error + func (p *Pubrel) String() string + func (p *Pubrel) Unpack(r io.Reader) error + type QoS = byte + type ReadWriter struct + type Reader struct + func NewReader(r io.Reader) *Reader + func (r *Reader) ReadPacket() (Packet, error) + func (r *Reader) SetVersion(version Version) + type SubOptions struct + NoLocal bool + Qos uint8 + RetainAsPublished bool + RetainHandling byte + type Suback struct + FixHeader *FixHeader + PacketID PacketID + Payload []codes.Code + Properties *Properties + Version Version + func NewSubackPacket(fh *FixHeader, version Version, r io.Reader) (*Suback, error) + func (p *Suback) Pack(w io.Writer) error + func (p *Suback) String() string + func (p *Suback) Unpack(r io.Reader) error + type Subscribe struct + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + Topics []Topic + Version Version + func NewSubscribePacket(fh *FixHeader, version Version, r io.Reader) (*Subscribe, error) + func (p *Subscribe) NewSuback() *Suback + func (p *Subscribe) Pack(w io.Writer) error + func (p *Subscribe) String() string + func (p *Subscribe) Unpack(r io.Reader) (err error) + type Topic struct + Name string + type Unsuback struct + FixHeader *FixHeader + PacketID PacketID + Payload []codes.Code + Properties *Properties + Version Version + func NewUnsubackPacket(fh *FixHeader, version Version, r io.Reader) (*Unsuback, error) + func (p *Unsuback) Pack(w io.Writer) error + func (p *Unsuback) String() string + func (p *Unsuback) Unpack(r io.Reader) error + type Unsubscribe struct + FixHeader *FixHeader + PacketID PacketID + Properties *Properties + Topics []string + Version Version + func NewUnsubscribePacket(fh *FixHeader, version Version, r io.Reader) (*Unsubscribe, error) + func (u *Unsubscribe) NewUnSubBack() *Unsuback + func (u *Unsubscribe) Pack(w io.Writer) error + func (u *Unsubscribe) String() string + func (u *Unsubscribe) Unpack(r io.Reader) error + type UserProperty struct + K []byte + V []byte + type Version = byte + const MaximumSize + const Version31 + const Version311 + const Version5 + type Writer struct + func NewWriter(w io.Writer) *Writer + func (w *Writer) Flush() error + func (w *Writer) WriteAndFlush(packet Packet) error + func (w *Writer) WritePacket(packet Packet) error + func (w *Writer) WriteRaw(b []byte) error