transport

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUDPAddr

func GetUDPAddr(address string) (sendAddr *net.UDPAddr)

Types

type Connection

type Connection struct {
	SendConn []*net.UDPConn
	// contains filtered or unexported fields
}

Connection is the state and working memory references for a simple reliable UDP lan transport, encrypted by a GCM AES cipher, with the simple protocol of sending out 9 packets containing encrypted FEC shards containing a slice of bytes. This protocol probably won't work well outside of a multicast lan in adverse conditions but it is designed for local network control systems

func NewConnection

func NewConnection(send, listen, preSharedKey string, maxDatagramSize int, ctx context.Context, multicast bool) (c *Connection, err error)

NewConnection creates a new connection with a defined default send connection and listener and pre shared key password for encryption on the local network

func (*Connection) CreateShards

func (c *Connection) CreateShards(b, magic []byte) (shards [][]byte,
	err error)

func (*Connection) Listen

func (c *Connection) Listen(handlers HandleFunc, ifc interface{},
	lastSent *time.Time, firstSender *string) (err error)

func (*Connection) Send

func (c *Connection) Send(b, magic []byte) (err error)

func (*Connection) SendShards

func (c *Connection) SendShards(shards [][]byte) (err error)

func (*Connection) SendShardsTo

func (c *Connection) SendShardsTo(shards [][]byte, addr *net.UDPAddr) (err error)

func (*Connection) SendTo

func (c *Connection) SendTo(addr *net.UDPAddr, b, magic []byte) (err error)

func (*Connection) SetSendConn

func (c *Connection) SetSendConn(ad ...string) (err error)

type HandleFunc

type HandleFunc map[string]func(ctx interface{}) func(b []byte) (err error)

type MsgBuffer

type MsgBuffer struct {
	Buffers [][]byte
	First   time.Time
	Decoded bool
	Source  *net.Addr
}

Jump to

Keyboard shortcuts

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