sudp

package
v0.0.0-...-d3354c4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: LGPL-2.1 Imports: 17 Imported by: 0

README

SUDP

SUDP is a simple protocol for secure and multiplexed communication over UDP. It is mainly to serve as a reference implementation of a transport for f2f. It should be considered insecure.

It is loosely based on CryptoAuth from the cjdns project. It uses Salsa20-Poly1305 for authenticated encryption, as provided by the NaCl library. Session keys are exchanged and computed using Curve25519.

Documentation

Index

Constants

View Source
const Overhead = secretbox.Overhead + 8
View Source
const SessionKeySize = 32
View Source
const UDPMTU = 1500

Variables

View Source
var (
	AlertBadMac           = Alert("Bad Mac")
	AlertInvalidSignature = Alert("Invalid Signature")
	AlertAuthVeto         = Alert("Public key was denied by auth func")
)

Functions

This section is empty.

Types

type Alert

type Alert string

func (Alert) String

func (a Alert) String() string

type Channel

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

func (*Channel) Close

func (c *Channel) Close() error

func (*Channel) MTU

func (c *Channel) MTU() int

func (*Channel) OnClose

func (c *Channel) OnClose(cb func())

func (*Channel) OnData

func (c *Channel) OnData(cb func())

func (*Channel) Parent

func (c *Channel) Parent() transports.MuxingConn

func (*Channel) Read

func (c *Channel) Read(p []byte) (n int, err error)

func (*Channel) Write

func (c *Channel) Write(p []byte) (n int, err error)

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() string

func (*Conn) MTU

func (c *Conn) MTU() int

func (*Conn) Open

func (c *Conn) Open(channelName string) (transports.Channel, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() string

func (*Conn) RemoteID

func (c *Conn) RemoteID() friends.ID

type Dialer

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

func NewDialer

func NewDialer(priv f2fcrypto.PrivateKey, laddr string) *Dialer

func (*Dialer) Dial

func (d *Dialer) Dial(who f2fcrypto.PublicKey, raddr string) (transports.MuxingConn, error)

type HelloPacket

type HelloPacket struct {
	SessionKey   [SessionKeySize]byte
	Signature    []byte
	PermanentKey f2fcrypto.PublicKey
}

func (*HelloPacket) Marshal

func (hp *HelloPacket) Marshal() ([]byte, error)

func (*HelloPacket) Unmarshal

func (hp *HelloPacket) Unmarshal(b []byte) (err error)

type Listener

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

func NewListener

func NewListener(priv f2fcrypto.PrivateKey, af friends.AuthFunc, laddr string) (l *Listener, err error)

func (*Listener) Accept

func (l *Listener) Accept() (transports.MuxingConn, error)

func (*Listener) Addr

func (l *Listener) Addr() string

func (*Listener) Close

func (l *Listener) Close() error

type ReplayProtector

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

func (*ReplayProtector) Recieved

func (rp *ReplayProtector) Recieved(n uint32)

func (*ReplayProtector) ShouldAllow

func (rp *ReplayProtector) ShouldAllow(n uint32) bool

type Session

type Session struct {
	Private, Public, Remote, Shared [SessionKeySize]byte
	// contains filtered or unexported fields
}

func (*Session) GetNonce

func (s *Session) GetNonce() (n uint32)

Jump to

Keyboard shortcuts

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