Documentation ¶
Overview ¶
Package sub is a short message publication/subscription library that uses UDP transport, Reed Solomon erasure coding, ed25519 EC signatures for tamper-resistance, for allowing clients to subscribe to updates from a server for time-sensitive messaging, written to implement a low latency work delivery system for Parallelcoin miners.
To prevent retransmits for messages up to 3kb in size, data sent in a burst as 9 packets containing a 9/3 Reed Solomon encoding such that any 3 packets received guarantee retransmit-less delivery, covering the worst case for packet loss and corruption over a network
Payload can be encrypted via AES-256 encryption using a pre-shared key known by both ends to function as both access control and security against eavesdropping and spoofing attacks.
Authentication of data is done using an ED25119 EC key for which each known endpoint has shared the public key as part of the subscription request
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeAddrToBytes ¶
EncodeAddrToBytes takes a string in the format xxx.xxx.xxx.xxx:xxxxx and converts it to the encoded bytes format
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base is the common structure between a worker and a node
func NewBase ¶
Implementations of common parts for node and worker NewBase creates a new base listener
func (*Base) Send ¶
Send a message of up to maxMessageSize bytes to a given UDP address
func (*Base) Start ¶
Start attempts to open a listener and commences receiving packets and assembling them into messages
type BaseCfg ¶
type BaseCfg struct { Handler func(message Message) Listener string Password []byte BufferSize int }
BaseCfg is the configuration for a Base
type BaseInterface ¶
type BaseInterface interface {
SetupListener()
}
BaseInterface is the core functions required for a Base
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
A Bundle is a collection of the received packets received from the same sender with up to 9 pieces.
type Confirmation ¶
type Confirmation struct { }
Confirmation is the reply message for a subscription request
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is the data reconstructed from a complete Bundle, containing data in messagepack format
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet is the structure of individual encoded packets of the message. These are made from a 9/3 Reed Solomon code and 9 are sent in distinct packets and only 3 are required to guarantee retransmit-free delivery.
type Subscription ¶
type Subscription struct { }
Subscription is the message sent by a worker node to request updates from the node