broadcast

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Unlicense Imports: 9 Imported by: 0

Documentation

Overview

Package broadcast is a simple udp broadcast

Index

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 Decode

func Decode(ciph cipher.AEAD, shards [][]byte) (bytes []byte, err error)

func Encode

func Encode(ciph cipher.AEAD, bytes []byte, typ []byte) (shards [][]byte,
	err error)

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

func Listen(address string, handler func(*net.UDPAddr, int, []byte)) (cancel context.CancelFunc)

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

func New

func New(address string) (addr *net.UDPAddr, err error)

New creates a new UDP multicast address on which to broadcast

func Send

func Send(addr *net.UDPAddr, bytes []byte, ciph cipher.AEAD,
	typ []byte) (err error)

Send broadcasts bytes on the given multicast address

Types

This section is empty.

Jump to

Keyboard shortcuts

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