mqtt

package module
v0.0.0-...-a020867 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CONNECT     PacketType = 1
	CONNACK                = 2
	PUBLISH                = 3
	PUBACK                 = 4
	PUBREC                 = 5
	PUBREL                 = 6
	PUBCOMP                = 7
	SUBSCRIBE              = 8
	SUBACK                 = 9
	UNSUBSCRIBE            = 10
	UNSUBACK               = 11
	PINGREQ                = 12
	PINGRESP               = 13
	DISCONNECT             = 14
)

List of packet types

View Source
const (
	PropPayloadFormat     Property = 0x01 // Payload Format Indicator
	PropMsgExpiry                  = 0x02 // Message Expiry Interval
	PropContentType                = 0x03 // Content Type
	PropRespTopic                  = 0x08 // Response Topic
	PropCorrelData                 = 0x09 // Correlation Data
	PropSubsIdent                  = 0x0B // Subscription Identifier
	PropSessExpiry                 = 0x11 // Session Expiry Interval
	PropClientIdet                 = 0x12 // Assigned Client Identifier
	PropServerKeepAlive            = 0x13 // Server Keep Alive
	PropAuthMethod                 = 0x15 // Authentication Method
	PropAuthData                   = 0x16 // Authentication Data
	PropReqProblem                 = 0x17 // Request Problem Information
	PropWillDelay                  = 0x18 // Will Delay Interval
	PropReqRespInfo                = 0x19 // Request Response Information
	PropRespInfo                   = 0x1A // Response Information
	PropServerRef                  = 0x1C // Server Reference
	PropReason                     = 0x1F // Reason String
	PropRecvMax                    = 0x21 // Receive Maximum
	PropTopicAliasMax              = 0x22 // Topic Alias Maximum
	PropTopicAlias                 = 0x23 // Topic Alias
	PropMaxQoS                     = 0x24 // Maximum QoS
	PropRetainAvailable            = 0x25 // Retain Available
	PropUser                       = 0x26 // User Property
	PropMaxPacket                  = 0x27 // Maximum Packet Size
	PropWildcardSubsAvail          = 0x28 // Wildcard Subscription Available
	PropSubsIdentAvail             = 0x29 // Subscription Identifier Available
	PropSharedSubsAvail            = 0x2A // Shared Subscription Available
)

Packet Properties

Variables

View Source
var ErrMaxPending = errors.New("reached max pending")
View Source
var ErrServerClose = errors.New("server close")
View Source
var ErrSessionOvertake = errors.New("session overtaken")
View Source
var InvalidQoS = errors.New("invalid QoS")
View Source
var MaxPending = 16

Functions

func ListenAndServe

func ListenAndServe(addr string, server Server) error

ListenAndServe listens at the give tcp address.

func ListenAndServeTLS

func ListenAndServeTLS(addr string, config *tls.Config, server Server) error

ListenAndServeTLS listens at the give tcp address.

func Serve

func Serve(listener net.Listener, server Server) error

Serve accepts listeners and hands them over to the server.

Types

type Authenticate

type Authenticate func(client *Client, auth *ConnectAuth) ConnectCode

Authenticate is a simple function to check a client and its authentication.

type Client

type Client struct {
	MaxPending int

	LogLevel LogLevel

	Server Server
	// contains filtered or unexported fields
}

Client is a MQTT Client. Use `Dial` to create a new client.

func Dial

func Dial(addr string, id string, cleanSession bool, auth *ConnectAuth, will *Message) (*Client, error)

Dial connects to a remote MQTT server.

func (*Client) Acknowledge

func (client *Client) Acknowledge(mid int)

func (*Client) Disconnect

func (client *Client) Disconnect() error

func (*Client) ID

func (client *Client) ID() string

func (*Client) Message

func (client *Client) Message() (*Message, error)

Message waits for a incomming publish.

func (*Client) NumPending

func (client *Client) NumPending() int

NumPending gives the number of outstanding QoS>0 packets that have now been acknowledged yet.

func (*Client) Packet

func (client *Client) Packet() (Packet, *Message, error)

func (*Client) Ping

func (client *Client) Ping() error

Ping sends a Ping packet.

func (*Client) Publish

func (client *Client) Publish(msg *Message) error

Publish a new message.

func (*Client) Send

func (client *Client) Send(pkt Packet) error

Send a MQTT controll packet.

func (*Client) SetLogger

func (client *Client) SetLogger(logger *log.Logger, level LogLevel)

func (*Client) Subscribe

func (client *Client) Subscribe(topic string, qos byte) (byte, error)

func (*Client) SubscribeAll

func (client *Client) SubscribeAll(topics []TopicSubscription) ([]byte, error)

func (*Client) Unsubscribe

func (client *Client) Unsubscribe(topics ...string)

func (*Client) Will

func (client *Client) Will() *Message

type ConnAckPacket

type ConnAckPacket struct {
	SessionPresent bool
	Code           ConnectCode
	// contains filtered or unexported fields
}

ConnAckPacket is a MQTT CONNACK control packet.

func ConnAck

func ConnAck(code ConnectCode, sessPresent bool) *ConnAckPacket

ConnAck creates a new MQTT CONNACK control packet.

func (*ConnAckPacket) Header

func (pkt *ConnAckPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*ConnAckPacket) String

func (pkt *ConnAckPacket) String() string

String stringifies the packet in a human readable format.

func (*ConnAckPacket) WriteTo

func (pkt *ConnAckPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type ConnectAuth

type ConnectAuth struct {
	Username, Password string
}

ConnectAuth is the authentication used with Connect packets.

type ConnectCode

type ConnectCode byte
const (
	CodeAccepted ConnectCode = iota
	CodeUnacceptableProtoV
	CodeIDentifierRejected
	CodeServerUnavaliable
	CodeBatUserOrPassword
	CodeNotAuthorized
)

func (ConnectCode) String

func (c ConnectCode) String() string

type ConnectPacket

type ConnectPacket struct {

	// Variable Header
	Protocol       string
	Version        byte
	CleanSession   bool
	KeepAliveTimer int
	// Payload
	ClientID string
	Will     *Message
	Auth     *ConnectAuth
	// contains filtered or unexported fields
}

ConnectPacket is a MQTT CONNECT control packet.

func Connect

func Connect(protocol string, version byte, cleanSession bool, keepAliveTimer int, clientID string, will *Message, auth *ConnectAuth) *ConnectPacket

Connect creates a new MQTT CONNECT control packet.

func (*ConnectPacket) Header

func (pkt *ConnectPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*ConnectPacket) String

func (pkt *ConnectPacket) String() string

String stringifies the packet in a human readable format.

func (*ConnectPacket) WriteTo

func (pkt *ConnectPacket) WriteTo(w io.Writer, version byte) (len int, err error)

WriteTo writes the packet to the io.Writer.

type DisconnectPacket

type DisconnectPacket struct {
	// contains filtered or unexported fields
}

DisconnectPacket is a MQTT DISCONNECT control packet.

func Disconnect

func Disconnect() *DisconnectPacket

Disconnect creates a new MQTT DISCONNECT packet.

func (*DisconnectPacket) Header

func (pkt *DisconnectPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*DisconnectPacket) String

func (pkt *DisconnectPacket) String() string

String stringifies the packet in a human readable format.

func (*DisconnectPacket) WriteTo

func (pkt *DisconnectPacket) WriteTo(w io.Writer, version byte) (int, error)

WriteTo writes the packet to the io.Writer.

type FixedHeader

type FixedHeader struct {
	PacketType PacketType
	Dup        bool
	QoS        byte
	Retain     bool
	Length     int
}

FixedHeader is used with every package.

func (*FixedHeader) Read

func (fh *FixedHeader) Read(reader io.Reader) (int, error)

Read reads a FixedHeader from an io.Reader.

func (*FixedHeader) ReadBuffer

func (fh *FixedHeader) ReadBuffer(buf []byte) (int, error)

Read reads a FixedHeader from an io.Reader.

func (*FixedHeader) WriteTo

func (fh *FixedHeader) WriteTo(w io.Writer) (int, error)

WriteTo writes the FixedHeader to an io.Writer.

type LogLevel

type LogLevel int
const (
	LogLevelErrors   LogLevel = -2
	LogLevelWarnings LogLevel = -1
	LogLevelNormal   LogLevel = 0
	LogLevelVerbose  LogLevel = 1
	LogLevelDebug             = 2
)

type Message

type Message struct {
	// Topic of this message.
	Topic string
	// Data
	Data []byte
	// QoS = Quality of Service
	QoS byte
	// Retain is true if the message is a Retain Message.
	Retain bool
}

Message is a published message for a topic a the given QoS.

func (*Message) Equals

func (msg *Message) Equals(other *Message) bool

Equals checks if both message are the same.

type Packet

type Packet interface {
	WriteTo(w io.Writer, version byte) (len int, err error)
	Header() *FixedHeader
	String() string
}

func Read

func Read(reader io.Reader, version byte) (Packet, int, error)

Read reads a packet from an io.Reader.

func ReadBuffer

func ReadBuffer(buf []byte, version byte) (Packet, error)

ReadBuffer reads a packet from the buffer.

type PacketType

type PacketType byte

PacketType is the MQTT Control Packet type. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901022

func (PacketType) String

func (p PacketType) String() string

type PingReqPacket

type PingReqPacket struct {
	// contains filtered or unexported fields
}

PingReqPacket is a MQTT PINGREQ control packet.

func PingReq

func PingReq() *PingReqPacket

PingReqPacket creates a new MQTT PINGREQ packet.

func (*PingReqPacket) Header

func (pkt *PingReqPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PingReqPacket) String

func (pkt *PingReqPacket) String() string

String stringifies the packet in a human readable format.

func (*PingReqPacket) WriteTo

func (pkt *PingReqPacket) WriteTo(w io.Writer, version byte) (int, error)

WriteTo writes the packet to the io.Writer.

type PingRespPacket

type PingRespPacket struct {
	// contains filtered or unexported fields
}

PingRespPacket is a MQTT PINGRESP control packet.

func PingResp

func PingResp() *PingRespPacket

PingResp creates a new MQTT PINGRESP packet.

func (*PingRespPacket) Header

func (pkt *PingRespPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PingRespPacket) String

func (pkt *PingRespPacket) String() string

String stringifies the packet in a human readable format.

func (*PingRespPacket) WriteTo

func (pkt *PingRespPacket) WriteTo(w io.Writer, version byte) (int, error)

WriteTo writes the packet to the io.Writer.

type Property

type Property byte

Property fields See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901027

func (Property) String

func (prop Property) String() string

type PubAckPacket

type PubAckPacket struct {
	ID int
	// contains filtered or unexported fields
}

PubAckPacket is a MQTT PUBACK control packet.

func PubAck

func PubAck(id int) *PubAckPacket

PubAck creates a new MQTT PUBACK packet.

func (*PubAckPacket) Header

func (pkt *PubAckPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PubAckPacket) String

func (pkt *PubAckPacket) String() string

String stringifies the packet in a human readable format.

func (*PubAckPacket) WriteTo

func (pkt *PubAckPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type PubCompPacket

type PubCompPacket struct {
	ID int
	// contains filtered or unexported fields
}

PubCompPacket is a MQTT PUBCOMP control packet.

func PubComp

func PubComp(id int) *PubCompPacket

PubComp creates a new MQTT PUBCOMP packet.

func (*PubCompPacket) Header

func (pkt *PubCompPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PubCompPacket) String

func (pkt *PubCompPacket) String() string

String stringifies the packet in a human readable format.

func (*PubCompPacket) WriteTo

func (pkt *PubCompPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type PubRecPacket

type PubRecPacket struct {
	ID int
	// contains filtered or unexported fields
}

PubRecPacket is a MQTT PUBREC control packet.

func PubRec

func PubRec(id int) *PubRecPacket

PubRec creates a new MQTT PUBREC packet.

func (*PubRecPacket) Header

func (pkt *PubRecPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PubRecPacket) String

func (pkt *PubRecPacket) String() string

String stringifies the packet in a human readable format.

func (*PubRecPacket) WriteTo

func (pkt *PubRecPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type PubRelPacket

type PubRelPacket struct {
	ID int
	// contains filtered or unexported fields
}

PubRelPacket is a MQTT PUBREL control packet.

func PubRel

func PubRel(id int) *PubRelPacket

PubRel creates a new MQTT PUBREL packet.

func (*PubRelPacket) Header

func (pkt *PubRelPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PubRelPacket) String

func (pkt *PubRelPacket) String() string

String stringifies the packet in a human readable format.

func (*PubRelPacket) WriteTo

func (pkt *PubRelPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type PublishPacket

type PublishPacket struct {

	// Variable Header
	Topic string // Publish Topic
	ID    int    // Message ID
	// Payload
	Data []byte
	// contains filtered or unexported fields
}

PublishPacket is a MQTT PUBLISH packet.

func Publish

func Publish(id int, msg *Message) *PublishPacket

Publish creates a new MQTT PUBLISH control packet.

func (*PublishPacket) Header

func (pkt *PublishPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*PublishPacket) Message

func (pkt *PublishPacket) Message() *Message

Message returns the Message that this Publish packets transports.

func (*PublishPacket) String

func (pkt *PublishPacket) String() string

String stringifies the packet in a human readable format.

func (*PublishPacket) WriteTo

func (pkt *PublishPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type QoS

type QoS byte

QoS is the "Quality of Service"

const (
	// AtMostOnce is QoS level 0
	AtMostOnce QoS = 0
	// AtLeasOnce is QoS level 1
	AtLeasOnce QoS = 1
	// ExactlyOnce is QoS level 2
	ExactlyOnce QoS = 2
	// Failure indicates a QoS failure.
	Failure QoS = 128
)

type ReasonCode

type ReasonCode byte

A ReasonCode is a one byte unsigned value that indicates the result of an operation. Reason Codes less than 0x80 indicate successful completion of an operation. The normal Reason Code for success is 0. Reason Code values of 0x80 or greater indicate failure. https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901031

const (
	ReasonSuccess           ReasonCode = 0x00 // Success
	ReasonDisconnect        ReasonCode = 0x00 // Normal disconnection
	ReasonQoS0              ReasonCode = 0x00 // Granted QoS 0
	ReasonQoS1              ReasonCode = 0x01 // Granted QoS 1
	ReasonQoS2              ReasonCode = 0x02 // Granted QoS 2
	ReasonDisconnectWill    ReasonCode = 0x04 // Disconnect with Will Message
	ReasonNoSubsMatch       ReasonCode = 0x10 // No matching subscribers
	ReasonNoSubsExist       ReasonCode = 0x11 // No subscription existed
	ReasonContinueAuth      ReasonCode = 0x18 // Continue authentication
	ReasonReAuth            ReasonCode = 0x19 // Re-authenticate
	ReasonUnspecErr         ReasonCode = 0x80 // Unspecified error
	ReasonMalfPacket        ReasonCode = 0x81 // Malformed Packet
	ReasonProtoErr          ReasonCode = 0x82 // Protocol Error
	ReasonImplSpec          ReasonCode = 0x83 // Implementation specific
	ReasonUnsupProtoV       ReasonCode = 0x84 // Unsupported Protocol Version
	ReasonClientIDInvalid   ReasonCode = 0x85 // Client Identifier not valid
	ReasonBadAuth           ReasonCode = 0x86 // Bad User Name or Password
	ReasonNotAuth           ReasonCode = 0x87 // Not authorized
	ReasonUnavail           ReasonCode = 0x88 // Server unavailable
	ReasonBusy              ReasonCode = 0x89 // Server busy
	ReasonBanned            ReasonCode = 0x8A // Banned
	ReasonSuttingDown       ReasonCode = 0x8B // Server shutting down
	ReasonBadAuthMehtod     ReasonCode = 0x8C // Bad authentication method
	ReasonKeepAliveTimeout  ReasonCode = 0x8D // Keep Alive timeout
	ReasonSessionTaken      ReasonCode = 0x8E // Session taken over
	ReasonInvalFilter       ReasonCode = 0x8F // Topic Filter invalid
	ReasonInvalName         ReasonCode = 0x90 // Topic Name invalid
	ReasonIdentInUse        ReasonCode = 0x91 // Packet Identifier in use
	ReasonIdentNotFound     ReasonCode = 0x92 // Packet Identifier not found
	ReasonMaxReceive        ReasonCode = 0x93 // Receive Maximum exceeded
	ReasonInvalAlias        ReasonCode = 0x94 // Topic Alias invalid
	ReasonTooLarge          ReasonCode = 0x95 // Packet too large
	ReasonHighRate          ReasonCode = 0x96 // Message rate too high
	ReasonQuotaExceeded     ReasonCode = 0x97 // Quota exceeded
	ReasonAdmin             ReasonCode = 0x98 // Administrative action
	ReasonInvalFormat       ReasonCode = 0x99 // Payload format invalid
	ReasonUnsupRetain       ReasonCode = 0x9A // Retain not supported
	ReasonUnsupQoS          ReasonCode = 0x9B // QoS not supported
	ReasonUseAnother        ReasonCode = 0x9C // Use another server
	ReasonMoved             ReasonCode = 0x9D // Server moved
	ReasonUnsubShared       ReasonCode = 0x9E // Shared Subscriptions not supported
	ReasonConnReateExceeded ReasonCode = 0x9F // Connection rate exceeded
	ReasonMaxConnTime       ReasonCode = 0xA0 // Maximum connect time
	ReasonUnsupSubsIdent    ReasonCode = 0xA1 // Subscription Identifiers not supported
	ReasonUnsupWildcard     ReasonCode = 0xA2 // Wildcard Subscriptions not supported
)

Reason Codes

func (ReasonCode) Error

func (code ReasonCode) Error() error

Error transforms the RasonCode to an error. The error is nil if the reason is `ReasonSuccess` (which is not an error).

func (ReasonCode) String

func (code ReasonCode) String() string

type Reciever

type Reciever interface {
	Publish(msg *Message) error
	ID() string
}

Reciever can get messages from subscriptions.

type RecieverFunc

type RecieverFunc func(msg *Message) error

The RecieverFunc type is an adapter to allow the use of ordinary functions as Recievres.

func (RecieverFunc) ID

func (f RecieverFunc) ID() string

func (RecieverFunc) Publish

func (f RecieverFunc) Publish(msg *Message) error

Publish calls func.

type Sender

type Sender interface {
	ID() string
}

type Server

type Server interface {
	// Connect checks the ConnectAuth of a new client.
	Connect(client *Client, auth *ConnectAuth) ConnectCode
	// Close terminates the server an all client connection.
	Close() error
	// Serve makes the stream part of this server. This call is blocking and will read and write from the stream until the client or the server closes the connection.
	Serve(stream Stream)
	// Publish can be called from clients to emit new messages.
	Publish(sender Sender, msg *Message) int
	// Subscribe adds a new subscription to the topics tree.
	Subscribe(recv Reciever, topic string, qos byte) *Subscription
	// SubscribeAll adds a list of subscriptions to the topics tree.
	SubscribeAll(recv Reciever, topics []TopicSubscription) []*Subscription
	// Unsubscribe releases a subscription.
	Unsubscribe(subs ...*Subscription)
	// Disconnect removes a client that has diconnected.
	Disconnect(client *Client, reason error)
}

Server represents an MQTT server.

func NewServer

func NewServer(auth Authenticate, log *log.Logger, ll LogLevel) Server

NewServer creates a new server.

type Stream

type Stream interface {
	ReadPacket() (Packet, error)
	WritePacket(Packet) error
	Close() error
}

Stream is a Read/Write/Close interface for MQTT Packet streams.

func NewStream

func NewStream(conn net.Conn, tout time.Duration) Stream

NewStream creates a Stream that can read and write MQTT Packets from and to the io.ReadWriteCloser.

type SubAckPacket

type SubAckPacket struct {

	// Variable Header
	ID int // Message ID
	// Payload
	Granted []byte // List of granted QoS
	// contains filtered or unexported fields
}

SubAckPacket is a MQTT SUBACK control packet.

func SubAck

func SubAck(id int, granted []byte) *SubAckPacket

func (*SubAckPacket) Header

func (pkt *SubAckPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*SubAckPacket) String

func (pkt *SubAckPacket) String() string

String stringifies the packet in a human readable format.

func (*SubAckPacket) WriteTo

func (pkt *SubAckPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type SubscribePacket

type SubscribePacket struct {

	// Variable Header
	ID int // Message ID
	// Payload
	Topics []TopicSubscription // List of Subscriptions
	// contains filtered or unexported fields
}

SubscribePacket is a MQTT SUBSCRIBE control packet.

func Subscribe

func Subscribe(id int, topics []TopicSubscription) *SubscribePacket

Subscribe creates a new MQTT SUBSCRIBE control packet.

func (*SubscribePacket) Header

func (pkt *SubscribePacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*SubscribePacket) String

func (pkt *SubscribePacket) String() string

String stringifies the packet in a human readable format.

func (*SubscribePacket) WriteTo

func (pkt *SubscribePacket) WriteTo(w io.Writer, version byte) (len int, err error)

WriteTo writes the packet to the io.Writer.

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func (*Subscription) QoS

func (s *Subscription) QoS() byte

func (*Subscription) Topic

func (s *Subscription) Topic() string

type TopicSubscription

type TopicSubscription struct {
	Name string // Topic Name
	QoS  byte   // Subscriptions QoS
}

A TopicSubscription is used in Subscribe packets.

type UnsubAckPacket

type UnsubAckPacket struct {

	// Variable Header
	ID int // Message ID
	// contains filtered or unexported fields
}

UnsubAckPacket is a MQTT UNSUBACK control packet.

func UnsubAck

func UnsubAck(id int) *UnsubAckPacket

UnsubAck creates a new MQTT UNSUCKACK control packet

func (*UnsubAckPacket) Header

func (pkt *UnsubAckPacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*UnsubAckPacket) String

func (pkt *UnsubAckPacket) String() string

String stringifies the packet in a human readable format.

func (*UnsubAckPacket) WriteTo

func (pkt *UnsubAckPacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

type UnsubscribePacket

type UnsubscribePacket struct {

	// Variable Header
	ID int // Message ID
	// Payload
	Topics []string // List of Topics to unsubscribe
	// contains filtered or unexported fields
}

UnsubscribePacket is a MQTT UNSUBSCRIBE control packet.

func Unsubscribe

func Unsubscribe(id int, topics []string) *UnsubscribePacket

Unsubscribe creates a new MQTT UNSUBSCRIBE control packet.

func (*UnsubscribePacket) Header

func (pkt *UnsubscribePacket) Header() *FixedHeader

Header returns the FixedHeader of this packet.

func (*UnsubscribePacket) String

func (pkt *UnsubscribePacket) String() string

String stringifies the packet in a human readable format.

func (*UnsubscribePacket) WriteTo

func (pkt *UnsubscribePacket) WriteTo(w io.Writer, version byte) (n int, err error)

WriteTo writes the packet to the io.Writer.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL