Documentation ¶
Overview ¶
Package broadcast is a simple udp broadcast
Index ¶
- Constants
- Variables
- func Decode(ciph cipher.AEAD, shards [][]byte) (bytes []byte, err error)
- func Encode(ciph cipher.AEAD, bytes []byte, typ []byte) (shards [][]byte, err error)
- func Listen(address string, handler func(*net.UDPAddr, int, []byte)) (cancel context.CancelFunc)
- func New(address string) (addr *net.UDPAddr, err error)
- func Send(addr *net.UDPAddr, bytes []byte, ciph cipher.AEAD, typ []byte) (err error)
Constants ¶
View Source
const ( MaxDatagramSize = 8192 DefaultAddress = "239.0.0.0:11042" )
Variables ¶
View Source
var ( SolBlock = "solblock" TplBlock = "tplblock" Solution = []byte(SolBlock) Template = []byte(TplBlock) )
for fast elimination of irrelevant messages a magic 64 bit word is used to identify relevant types of messages and 64 bits so the buffer is aligned
Functions ¶
func Encode ¶
Encode creates Reed Solomon shards and encrypts them using the provided GCM cipher function (from pkg/gcm). Message type is given in the first byte of each shard so nodes can quickly eliminate erroneous or irrelevant messages
func Listen ¶
Listen binds to the UDP address and port given and writes packets received from that address to a buffer which is passed to a handler
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.