diff --git a/mqtt/packets/Connack.go b/mqtt/packets/Connack.go index a23e078..b4d81a0 100644 --- a/mqtt/packets/Connack.go +++ b/mqtt/packets/Connack.go @@ -12,27 +12,27 @@ type ConnectReasonCode byte const ( ConnectReasonCodeSuccess ConnectReasonCode = 0 - ConnectReasonCodeUnspecified = 128 - ConnectReasonCodeMalformedPacket = 129 - ConnectReasonCodeProtocolError = 130 - ConnectReasonCodeImplErorr = 131 - ConnectReasonCodeUnsupportedProtoVer = 132 - ConnectReasonCodeClientIDNotValid = 133 - ConnectReasonCodeBadUsernameOrPassword = 134 - ConnectReasonCodeNotAuthorized = 135 - ConnectReasonCodeServerUnavaliable = 136 - ConnectReasonCodeServerBusy = 137 - ConnectReasonCodeBanned = 138 - ConnectReasonCodeBadAuthenticationMethod = 140 - ConnectReasonCodeTopicNameInvalid = 144 - ConnectReasonCodePacketTooLarge = 149 - ConnectReasonCodeQuotaExceeded = 151 - ConnectReasonCodePayloadFormatInvalid = 153 - ConnectReasonCodeRetainNotSupported = 154 - ConnectReasonCodeQoSNotSupported = 155 - ConnectReasonCodeUseAnotherServer = 156 - ConnectReasonCodeServerMoved = 157 - ConnectReasonCodeConnectionRateExceeded = 159 + ConnectReasonCodeUnspecified ConnectReasonCode = 128 + ConnectReasonCodeMalformedPacket ConnectReasonCode = 129 + ConnectReasonCodeProtocolError ConnectReasonCode = 130 + ConnectReasonCodeImplErorr ConnectReasonCode = 131 + ConnectReasonCodeUnsupportedProtoVer ConnectReasonCode = 132 + ConnectReasonCodeClientIDNotValid ConnectReasonCode = 133 + ConnectReasonCodeBadUsernameOrPassword ConnectReasonCode = 134 + ConnectReasonCodeNotAuthorized ConnectReasonCode = 135 + ConnectReasonCodeServerUnavaliable ConnectReasonCode = 136 + ConnectReasonCodeServerBusy ConnectReasonCode = 137 + ConnectReasonCodeBanned ConnectReasonCode = 138 + ConnectReasonCodeBadAuthenticationMethod ConnectReasonCode = 140 + ConnectReasonCodeTopicNameInvalid ConnectReasonCode = 144 + ConnectReasonCodePacketTooLarge ConnectReasonCode = 149 + ConnectReasonCodeQuotaExceeded ConnectReasonCode = 151 + ConnectReasonCodePayloadFormatInvalid ConnectReasonCode = 153 + ConnectReasonCodeRetainNotSupported ConnectReasonCode = 154 + ConnectReasonCodeQoSNotSupported ConnectReasonCode = 155 + ConnectReasonCodeUseAnotherServer ConnectReasonCode = 156 + ConnectReasonCodeServerMoved ConnectReasonCode = 157 + ConnectReasonCodeConnectionRateExceeded ConnectReasonCode = 159 ) type ConnackPacket struct { diff --git a/mqtt/packets/PubAckRecRel.go b/mqtt/packets/PubAckRecRel.go index eaf851d..971adbc 100644 --- a/mqtt/packets/PubAckRecRel.go +++ b/mqtt/packets/PubAckRecRel.go @@ -9,14 +9,14 @@ type PubackReasonCode byte const ( PubackReasonCodeSuccess PubackReasonCode = 0 - PubackReasonCodeNoMatchingSubscribers = 16 - PubackReasonCodeUnspecifiedError = 128 - PubackReasonCodeImplementationSpecyficEror = 131 - PubackReasonCodeNotAuthorized = 135 - PubackReasonCodeTopicNameInvalid = 144 - PubackReasonCodePacketIDInUse = 145 - PubackReasonCodeQuotaExceeded = 151 - PubackReasonCodePayloadFormatInvalid = 153 + PubackReasonCodeNoMatchingSubscribers PubackReasonCode = 16 + PubackReasonCodeUnspecifiedError PubackReasonCode = 128 + PubackReasonCodeImplementationSpecyficEror PubackReasonCode = 131 + PubackReasonCodeNotAuthorized PubackReasonCode = 135 + PubackReasonCodeTopicNameInvalid PubackReasonCode = 144 + PubackReasonCodePacketIDInUse PubackReasonCode = 145 + PubackReasonCodeQuotaExceeded PubackReasonCode = 151 + PubackReasonCodePayloadFormatInvalid PubackReasonCode = 153 ) type PubackPacket struct { @@ -55,7 +55,7 @@ type PubrelReasonCode byte const ( PubrelReasonCodeSuccess PubackReasonCode = 0 - PubrelReasonPacketIDNotFound = 146 + PubrelReasonPacketIDNotFound PubackReasonCode = 146 ) type PubrelPacket struct { diff --git a/mqtt/packets/Subscriptions.go b/mqtt/packets/Subscriptions.go index 19610c9..e27ec31 100644 --- a/mqtt/packets/Subscriptions.go +++ b/mqtt/packets/Subscriptions.go @@ -118,18 +118,18 @@ func (p SubscribePacket) Visit(v PacketVisitor) { type SubackReasonCode byte const ( - SubackReasonGrantedQoSZero PubackReasonCode = 0 - SubackReasonGrantedQoSOne = 1 - SubackReasonGrantedQoSTwo = 2 - SubackReasonUnspecified = 128 - SubackReasonImplSpecificError = 131 - SubackReasonNotAuthorized = 135 - SubackReasonTopicFilterInvalid = 143 - SubackReasonPacketIDInUse = 145 - SubackReasonQuotaExceeded = 151 - SubackReasonSharedSubNotSupported = 158 - SubackReasonSubIDUnsupported = 161 - SubackReasonWildcardSubUnsupported = 162 + SubackReasonGrantedQoSZero SubackReasonCode = 0 + SubackReasonGrantedQoSOne SubackReasonCode = 1 + SubackReasonGrantedQoSTwo SubackReasonCode = 2 + SubackReasonUnspecified SubackReasonCode = 128 + SubackReasonImplSpecificError SubackReasonCode = 131 + SubackReasonNotAuthorized SubackReasonCode = 135 + SubackReasonTopicFilterInvalid SubackReasonCode = 143 + SubackReasonPacketIDInUse SubackReasonCode = 145 + SubackReasonQuotaExceeded SubackReasonCode = 151 + SubackReasonSharedSubNotSupported SubackReasonCode = 158 + SubackReasonSubIDUnsupported SubackReasonCode = 161 + SubackReasonWildcardSubUnsupported SubackReasonCode = 162 ) type SubAckPacket struct { @@ -219,11 +219,11 @@ type UnsubackReasonCode byte const ( UnsubackReasonSuccess UnsubackReasonCode = 0 - UnSubackReasonUnspecified = 128 - UnSubackReasonImplSpecificError = 131 - UnSubackReasonNotAuthorized = 135 - UnSubackReasonTopicFilterInvalid = 143 - UnSubackReasonPacketIDInUse = 145 + UnSubackReasonUnspecified UnsubackReasonCode = 128 + UnSubackReasonImplSpecificError UnsubackReasonCode = 131 + UnSubackReasonNotAuthorized UnsubackReasonCode = 135 + UnSubackReasonTopicFilterInvalid UnsubackReasonCode = 143 + UnSubackReasonPacketIDInUse UnsubackReasonCode = 145 ) type UnsubAckPacket struct { diff --git a/mqtt/packets/packets.go b/mqtt/packets/packets.go index 3a0ac72..f3c8474 100644 --- a/mqtt/packets/packets.go +++ b/mqtt/packets/packets.go @@ -33,21 +33,21 @@ type PacketType byte const ( PacketTypeReserved PacketType = 0 // Forbidden - PacketTypeConnect = 1 - PacketTypeConnack = 2 - PacketTypePublish = 3 - PacketTypePuback = 4 - PacketTypePubrec = 5 - PacketTypePubrel = 6 - PacketTypePubcomp = 7 - PacketTypeSubscribe = 8 - PacketTypeSuback = 9 - PacketTypeUnsubscribe = 10 - PacketTypeUnsuback = 11 - PacketTypePingreq = 12 - PacketTypePingresp = 13 - PacketTypeDisconnect = 14 - PacketTypeAuth = 15 + PacketTypeConnect PacketType = 1 + PacketTypeConnack PacketType = 2 + PacketTypePublish PacketType = 3 + PacketTypePuback PacketType = 4 + PacketTypePubrec PacketType = 5 + PacketTypePubrel PacketType = 6 + PacketTypePubcomp PacketType = 7 + PacketTypeSubscribe PacketType = 8 + PacketTypeSuback PacketType = 9 + PacketTypeUnsubscribe PacketType = 10 + PacketTypeUnsuback PacketType = 11 + PacketTypePingreq PacketType = 12 + PacketTypePingresp PacketType = 13 + PacketTypeDisconnect PacketType = 14 + PacketTypeAuth PacketType = 15 ) func ReadPacket(r *bufio.Reader) (*ClientPacket, error) {