message

package
v0.0.0-...-001208e Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type  MsgType
	Nonce uint32 // random int for ack to reply back
	Len   uint32
	Body  []byte
}

func Deserialize

func Deserialize(data []byte) (*Message, error)

func NewAck

func NewAck(nonce uint32) Message

func NewDisconnect

func NewDisconnect() Message

func NewHello

func NewHello() Message

func NewKey

func NewKey(key []byte) Message

func NewMSG

func NewMSG(msg []byte) Message

func (*Message) Serialize

func (m *Message) Serialize() ([]byte, error)

type MsgType

type MsgType uint32
const (
	HLLO MsgType = iota
	ACK          // delivery
	MSG          // text message
	KEY          // rsa public key
	RUOK         // ping
	IMOK         // pong
	DISC         // disconnect
)

func (MsgType) String

func (t MsgType) String() string

Jump to

Keyboard shortcuts

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