packet

package
v0.0.0-...-edd4e79 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

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
	DisconnectSharedSubscriptionNotSupported      = 0x9E
	DisconnectConnectionRateExceeded              = 0x9F
	DisconnectMaximumConnectTime                  = 0xA0
	DisconnectSubscriptionIdentifiersNotSupported = 0xA1
	DisconnectWildcardSubscriptionsNotSupported   = 0xA2
)
View Source
const (
	CONNECT byte
	CONNACK
	PUBLISH
	PUBACK
	PUBREC
	PUBREL
	PUBCOMP
	SUBSCRIBE
	SUBACK
	UNSUBSCRIBE
	UNSUBACK
	PINGREQ
	PINGRESP
	DISCONNECT
	AUTH
)
View Source
const (
	PublishAckSuccess                     = 0x00
	PublishAckNoMatchingSubscribers       = 0x10
	PublishAckUnspecifiedError            = 0x80
	PublishAckImplementationSpecificError = 0x83
	PublishAckNotAuthorized               = 0x87
	PublishAckTopicNameInvalid            = 0x90
	PublishAckPacketIdentifierInUse       = 0x91
	PublishAckQuotaExceeded               = 0x97
	PublishAckPayloadFormatInvalid        = 0x99
)

Variables

View Source
var File_message_proto protoreflect.FileDescriptor

Functions

func NewPublishAck

func NewPublishAck() *packets.Puback

func NewPublishComp

func NewPublishComp() *packets.Pubcomp

func NewPublishRec

func NewPublishRec() *packets.Pubrec

func NewPublishRel

func NewPublishRel() *packets.Pubrel

func WritePacket

func WritePacket(writer io.Writer, packet packets.Packet) error

Types

type ConnectProperties

type ConnectProperties struct {
	SessionExpiryInterval int64  `json:"session_expiry_interval,omitempty"`
	ReceiveMaximum        int64  `json:"receive_maximum,omitempty"`
	MaximumPacketSize     int64  `json:"maximum_packet_size,omitempty"`
	TopicAliasMaximum     int64  `json:"topic_alias_maximum,omitempty"`
	RequestResponseInfo   string `json:"request_response_info,omitempty"`
	RequestProblemInfo    bool   `json:"request_problem_info,omitempty"`
	UserProperties        []User `json:"user_properties,omitempty"`
	AuthMethod            string `json:"auth_method,omitempty"`
	AuthData              []byte `json:"auth_data,omitempty"`
}

func PropertyToConnectProperties

func PropertyToConnectProperties(properties *packets.Properties) (*ConnectProperties, error)

type PublishMessage

type PublishMessage struct {
	ClientID      string
	MessageID     string
	PublishPacket *packets.Publish
	PubRelPacket  *packets.Pubrel
	PubReceived   bool
	FromSession   bool
	TimeStamp     int64
	ExpiredTime   int64
	Will          bool
}

type StorePublishMessage

type StorePublishMessage struct {
	MessageID     string `protobuf:"bytes,1,opt,name=MessageID,proto3" json:"MessageID,omitempty"`
	PublishPacket []byte `protobuf:"bytes,2,opt,name=PublishPacket,proto3" json:"PublishPacket,omitempty"`
	PubRelPacket  []byte `protobuf:"bytes,3,opt,name=PubRelPacket,proto3" json:"PubRelPacket,omitempty"`
	PubReceived   bool   `protobuf:"varint,4,opt,name=PubReceived,proto3" json:"PubReceived,omitempty"`
	FromSession   bool   `protobuf:"varint,5,opt,name=FromSession,proto3" json:"FromSession,omitempty"`
	TimeStamp     int64  `protobuf:"varint,6,opt,name=TimeStamp,proto3" json:"TimeStamp,omitempty"`
	ExpiredTime   int64  `protobuf:"varint,7,opt,name=ExpiredTime,proto3" json:"ExpiredTime,omitempty"`
	Will          bool   `protobuf:"varint,8,opt,name=Will,proto3" json:"Will,omitempty"`
	ClientID      string `protobuf:"bytes,9,opt,name=ClientID,proto3" json:"ClientID,omitempty"`
	// contains filtered or unexported fields
}

func (*StorePublishMessage) Descriptor deprecated

func (*StorePublishMessage) Descriptor() ([]byte, []int)

Deprecated: Use StorePublishMessage.ProtoReflect.Descriptor instead.

func (*StorePublishMessage) GetClientID

func (x *StorePublishMessage) GetClientID() string

func (*StorePublishMessage) GetExpiredTime

func (x *StorePublishMessage) GetExpiredTime() int64

func (*StorePublishMessage) GetFromSession

func (x *StorePublishMessage) GetFromSession() bool

func (*StorePublishMessage) GetMessageID

func (x *StorePublishMessage) GetMessageID() string

func (*StorePublishMessage) GetPubReceived

func (x *StorePublishMessage) GetPubReceived() bool

func (*StorePublishMessage) GetPubRelPacket

func (x *StorePublishMessage) GetPubRelPacket() []byte

func (*StorePublishMessage) GetPublishPacket

func (x *StorePublishMessage) GetPublishPacket() []byte

func (*StorePublishMessage) GetTimeStamp

func (x *StorePublishMessage) GetTimeStamp() int64

func (*StorePublishMessage) GetWill

func (x *StorePublishMessage) GetWill() bool

func (*StorePublishMessage) ProtoMessage

func (*StorePublishMessage) ProtoMessage()

func (*StorePublishMessage) ProtoReflect

func (x *StorePublishMessage) ProtoReflect() protoreflect.Message

func (*StorePublishMessage) Reset

func (x *StorePublishMessage) Reset()

func (*StorePublishMessage) String

func (x *StorePublishMessage) String() string

type StorePublishPacket

type StorePublishPacket interface {
	Encode() ([]byte, error)
	Decode([]byte) (packets.Publish, error)
}

type User

type User struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type WillProperties

type WillProperties struct {
	DelayInterval   int64  `json:"delay_interval,omitempty"`
	PayloadFormat   int64  `json:"payload_format"`
	ExpiryInterval  int64  `json:"expiry_interval"`
	ContentType     string `json:"content_type"`
	ResponseTopic   string `json:"response_topic"`
	CorrelationData []byte `json:"correlation_data,omitempty"`
	UserProperties  []User `json:"user_properties,omitempty"`
}

func PropertyToWillProperties

func PropertyToWillProperties(properties *packets.Properties) *WillProperties

Jump to

Keyboard shortcuts

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