sub

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: ISC, Unlicense Imports: 9 Imported by: 0

README

sub

Publish/Subscribe short message protocol with Reed-Solomon FEC and UDP transport

This has been written for implementing ultra low latency short messages for a miner work delivery protocol for Parallelcoin DUO

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

func EncodeAddrToBytes(
	addr string) (out []byte)

EncodeAddrToBytes takes a string in the format xxx.xxx.xxx.xxx:xxxxx and converts it to the encoded bytes format

func EncodedAddrToString

func EncodedAddrToString(
	encoded string) (out string)

EncodedAddrToString takes a string from bytes on the prefix containing an IPv4 address (it is passed around as a string for easy comparison) and returns the format used by net.Dial

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

func NewBase

func NewBase(
	cfg BaseCfg) (b *Base)

NewBase creates a new base listener

func (*Base) Send

func (b *Base) Send(data []byte, addr *net.UDPAddr) (err error)

Send a message of up to maxMessageSize bytes to a given UDP address

func (*Base) Start

func (b *Base) Start() (err error)

Start attempts to open a listener and commences receiving packets and assembling them into messages

func (*Base) Stop

func (b *Base) Stop()

Stop shuts down the listener

type BaseCfg

type BaseCfg struct {
	Handler    func(message Message)
	Listener   string
	Password   []byte
	BufferSize int
}

type BaseInterface

type BaseInterface interface {
	SetupListener()
}

type Bundle

type Bundle struct {
	// contains filtered or unexported fields
}

type Confirmation

type Confirmation struct {
	// contains filtered or unexported fields
}

type Message

type Message struct {
	// contains filtered or unexported fields
}

type Node

type Node struct {
	Base
	// contains filtered or unexported fields
}

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

type Worker

type Worker struct {
	Base
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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