gateway

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PeerIsMigratingError = errors.New("peer is migrating")
)

Functions

func LogFatal

func LogFatal(msg string, a ...interface{})

LogFatal logs a critical message and exits with error code 1

func WriteMsg

func WriteMsg(msg Message, writer io.Writer) error

Types

type Adapter

type Adapter interface {
	// ProcessCtrlMsg allows the adapter to receive ctrl messages (see Message)
	ProcessCtrlMsg(Message, addr.IA)
	// HandshakeComplete informs the Adapter of the completion of a setup with a remote gateway
	HandshakeComplete(PeerWriter)
	// Read shall provide a method to read packets of interest from the local network
	Read([]byte) (int, error)
	// ProcessIngressPkt shall processing packets coming from remote gateways and dispatch them to the local network
	ProcessIngressPkt([]byte)
	// ProcessEgressPkt shall process packets coming from the local network and dispatch them to remote gateways
	ProcessEgressPkt([]byte, func(string) (PeerWriter, error))
}

type Gateway

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

func NewGateway

func NewGateway(confBuf []byte, pathDBPath string) (*Gateway, error)

NewGateway returns a new Gateway.

func (*Gateway) GetAdapterConfPath

func (gateway *Gateway) GetAdapterConfPath() string

GetAdapterConfPath returns the file path of the Adapter configuration

func (*Gateway) ProcessEgressPkt

func (gateway *Gateway) ProcessEgressPkt(b []byte)

ProcessEgressPkt passes a packet received from an adapter to an egress worker

func (*Gateway) ProcessIngressPkt

func (gateway *Gateway) ProcessIngressPkt(b []byte)

ProcessIngressPkt passes a packet received from a peer to an ingress worker

func (*Gateway) SetAdapter

func (gateway *Gateway) SetAdapter(adapter Adapter)

func (*Gateway) Start

func (gateway *Gateway) Start()

Start the gateway by accepting incoming connection requests from other peers, connecting to other peers, and listening to incoming local traffic using the adapter

func (*Gateway) WriteMsgOneOff

func (gateway *Gateway) WriteMsgOneOff(msg Message, remoteAddr *snet.UDPAddr) error

WriteMsgOneOff writes a messages like WriteMsg but uses an ephemeral connection

type Message

type Message interface{}

func ReadMsg

func ReadMsg(reader readerFromAddr) (Message, *snet.UDPAddr, error)

type PathSorter

type PathSorter interface {
	SortPaths([]snet.Path) []snet.Path
}

type PeerWriter

type PeerWriter interface {
	CtrlWriter() io.Writer
	DataWriter() io.Writer
}

type RevocationHandler

type RevocationHandler struct{}

func (*RevocationHandler) RevokeRaw

func (r *RevocationHandler) RevokeRaw(ctx context.Context, rawSRevInfo common.RawBytes)

XXX: Not in use since revocation cannot be trusted to be reliable and to happen promptly

type YIA

type YIA struct {
	*addr.IA
}

YIA is a proxy for addr.IA to implement a custom Unmarshaler

func (*YIA) UnmarshalYAML

func (ia *YIA) UnmarshalYAML(unmarshal func(interface{}) error) error

type YUDPAddr

type YUDPAddr struct {
	*snet.UDPAddr
}

YUDPAddr is a proxy for snet.UDPAddr to implement a custom Unmarshaler

func (*YUDPAddr) UnmarshalYAML

func (addr *YUDPAddr) UnmarshalYAML(unmarshal func(interface{}) error) error

Directories

Path Synopsis
adapters
ip

Jump to

Keyboard shortcuts

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