func (d *Disconnect) Type() uint8 {
	return DISCONNECT
}
Type returns the MQTT packet type.
package lineprotocol
import (
	"bytes"
	"io"
)
type Packet interface {
	Type() uint8
	Info() Info
}
const (
	CONNECT = uint8(iota + 1)
	CONNACK
	PUBLISH
	PUBACK
	PUBREC
	PUBREL
	PUBCOMP
	SUBSCRIBE
	SUBACK
	UNSUBSCRIBE
	UNSUBACK
	PINGREQ
	PINGRESP
	DISCONNECT
)
type Info struct {
	Qos       uint8
	MessageID uint16
}
type FixedHeader struct {
	MessageType     byte
	Dup             bool
	Retain          bool
	Qos             uint8
	RemainingLength int
}
type Connect struct {
	ProtoName      []byte
	Version        uint8
	InsecureFlag   bool
	UsernameFlag   bool
	PasswordFlag   bool
	WillRetainFlag bool
	WillQOS        uint8
	WillFlag       bool
	CleanSessFlag  bool
	KeepAlive      uint16
	ClientID       []byte
	WillTopic      []byte
	WillMessage    []byte
	Username       []byte
	Password       []byte
	Packet
}
type Connack struct {
	ReturnCode uint8
	ConnID     uint32
	Packet
}
type Pingreq struct {
	Packet
}
type Pingresp struct {
	Packet
}
type Disconnect struct {
	Packet
}
type Publish struct {
	FixedHeader
	Topic       []byte
	MessageID   uint16
	IsForwarded bool
	Payload     []byte
	Packet
}
type Puback struct {
	MessageID uint16
	Packet
}
type Pubrec struct {
	FixedHeader
	MessageID uint16
	Packet
}
type Pubrel struct {
	FixedHeader
	MessageID uint16
	Packet
}
type Pubcomp struct {
	MessageID uint16
	Packet
}
type TopicQOSTuple struct {
	Qos   uint8
	Topic []byte
}
type Subscribe struct {
	FixedHeader
	MessageID     uint16
	IsForwarded   bool
	Subscriptions []TopicQOSTuple
	Packet
}
type Suback struct {
	MessageID uint16
	Qos       []uint8
	Packet
}
type Unsubscribe struct {
	FixedHeader
	MessageID     uint16
	IsForwarded   bool
	Subscriptions []TopicQOSTuple
	Packet
}
type Unsuback struct {
	MessageID uint16
	Packet
}
type ProtoAdapter interface {
	ReadPacket(r io.Reader) (Packet, error)
	Encode(pkt Packet) (bytes.Buffer, error)
}
func ReadPacket(adp ProtoAdapter, r io.Reader) (Packet, error) {
	return adp.ReadPacket(r)
}
func Encode(adp ProtoAdapter, pkt Packet) (bytes.Buffer, error) {
	return adp.Encode(pkt)
}
func (c *Connect) Type() uint8 {
	return CONNECT
}
func (c *Connect) Info() Info {
	return Info{Qos: 0, MessageID: 0}
}
func (c *Connack) Type() uint8 {
	return CONNACK
}
func (c *Connack) Info() Info {
	return Info{Qos: 0, MessageID: 0}
}
func (p *Pingreq) Type() uint8 {
	return PINGREQ
}
func (p *Pingreq) Info() Info {
	return Info{Qos: 0, MessageID: 0}
}
func (p *Pingresp) Type() uint8 {
	return PINGRESP
}
func (p *Pingresp) Info() Info {
	return Info{Qos: 0, MessageID: 0}
}