package
0.0.0-20230310201401-7aac46a7fa12
Repository: https://github.com/mitghi/protox.git
Documentation: pkg.go.dev
# README
protocol
Protox binary protocol.
PDU ( protocol data unit )
Queue
structure
MessageId : uint16
Address : string
ReturnPath : string
Mark : bytes
Message : bytes
fixed header
-
fixed header options:
bit semantic 0 1 hasPayload 2 isDuplicate 3 hasOpts
variable header
Options: 1 byte
-
options (0xF0):
bit semantic 0 hasMark 1 hasReturnPath 2 hasAddress 3 hasId -
command (0x0F):
bit semantic 4 NOP 5 Drain 6 Destroy 7 Initialize
types
-
payload item types:
payload type MessageId unsigned int32 Address string ReturnPath string Mark bytes Message bytes
Work in progress
- Chain to PDU extensions *.
- Support other protocols
- Support Adaptor
- extending current PDUs to exceed 0xF points ( i.e. linking via 0x0F in control packet )
# Functions
BoolToBytes converts a boolean value to a byte.
CreateHOptions creates a header containing options for Quality of Service, Duplicate packets and Retain.
No description provided by the author
No description provided by the author
No description provided by the author
DecodeLength decodes total packet length present in the heder.
EncodeLength encodes `buf` length as LSB, MSB and writes it to the buffer given by `buf` argument.
GetBytes reads n bytes from the buffer where n is total length as uint16.
GetHeaderBoundary reads the header part of a packet and writes it to a byte slice pointer given by `buf` argument, then returns header length.
GetString reads a `string` from a `io.Reader` and moves the pointer forward.
GetUint16 reads a `uint16` from a `io.Reader` and moves the pointer forward.
GetUint8 reads a single `byte` from a `io.Reader` and moves the pointer forward.
NewConnack returns a new `Connack` control packet.
No description provided by the author
NewConnect returns a new `Connect` control packet.
NewDisconnect returns a new `Disconnect` control packet.
NewMsgBox is a function that allocates and initializes a new `MsgBox` and return a pointer to it.
NewMsgEnvelope is a function that allocates and initializes a new `MsgEnvelope` and returns a pointer to it.
NewPing returns a new Ping control packet.
NewPong returns a pointer to a new `Pong` packet.
NewProtocol returns a new `Protocol` struct.
NewProtoMeta returns a pointer to a new `ProtoMeta` which includes metadata related to a control packet such as qulity of service and message id.
.
.
No description provided by the author
No description provided by the author
NewConnack returns a new `Connack` control packet.
NewConnect returns a new `Connect` control packet.
NewDisconnect returns a new `Disconnect` control packet.
NewPing returns a new Ping control packet.
NewPong returns a pointer to a new `Pong` packet.
.
.
No description provided by the author
No description provided by the author
.
.
.
.
.
.
.
.
ParseHCOptions is a function that parses 0x0F bits into initial Connect options.
ParseHOptions is a function that parses first 0x0F bits into Fixed Header options.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RaiseError raises a panic with a given `error`.
ReadPacket reads packets from a `*bufio.Reader` stream.
RecoverError catches `panic` inflight and handles them accordingly.
SetBytes writes a byte slice into the `buf` argument.
SetString writes a string as bytes into the `buf` argument.
SetUint16 writes a `uint16` to `buf` argument as LSB, MSB.
SetUint8 writes a single byte to `buf` argument.
# Variables
Protox Error messages.
Protox Error messages.
Protox Error messages.
Protox Error messages.
Protox Error messages.
Protox Error messages.
Error messages.
Protox Error messages.
Error messages.
Error messages.
Error messages.
Error messages.
Error messages.
No description provided by the author
# Structs
Connack is a control packet.
No description provided by the author
Connect establish connection.
Disconnect is a control packet.
MsgBox is a struct that conforms to `protobase.MessageBoxInterface`.
MsgEnvelope is a struct that conforms to `protobse.MsgEnvelopeInterface`.
No description provided by the author
No description provided by the author
Protocol is protocol structure embedded in each packet.
ProtoMeta is meta information embedded in each packet.
.
.
No description provided by the author
No description provided by the author
.
.
.
.