datamesh

package module
v0.0.0-...-50c22c9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

README

datamesh

A data plane and forwarder framework for overlay networks.

Documentation

Index

Constants

View Source
const (
	MinHeaderKey           = 2000
	CircuitIdHeaderKey     = 2001
	ControlFlagsHeaderKey  = 2256
	PingIdHeaderKey        = 2257
	PingTimestampHeaderKey = 2258
	MaxHeaderKey           = 2999
)

Variables

This section is empty.

Functions

func CircuitSetter

func CircuitSetter(v interface{}, f reflect.Value) error

func ProxyListenerFactorySetter

func ProxyListenerFactorySetter(v interface{}, opt *cf.Options) (interface{}, error)

func ProxyTerminatorFactorySetter

func ProxyTerminatorFactorySetter(v interface{}, opt *cf.Options) (interface{}, error)

func TransportAddressSetter

func TransportAddressSetter(v interface{}, f reflect.Value) error

func WestworldProfileFlexibleSetter

func WestworldProfileFlexibleSetter(v interface{}, opt *cf.Options) (interface{}, error)

Types

type Address

type Address string

type Circuit

type Circuit string

type Config

type Config struct {
	Listeners []*ListenerConfig
	Dialers   []*DialerConfig
	Profile   interface{}
}

type ContentType

type ContentType uint32
const (
	ControlContentType ContentType = 10099
	DataContentType    ContentType = 10100
)

type Control

type Control struct {
	Flags   uint32
	Headers map[int32][]byte
}

func NewControl

func NewControl(flags uint32, headers map[int32][]byte) *Control

func UnmarshalControl

func UnmarshalControl(msg *channel.Message) (*Control, error)

func (*Control) Marshal

func (self *Control) Marshal() *channel.Message

type ControlFlag

type ControlFlag uint32
const (
	PingRequestControlFlag  ControlFlag = 1
	PingResponseControlFlag ControlFlag = 2
)

type Datamesh

type Datamesh struct {
	Fwd      *Forwarder
	Handlers *Handlers
	// contains filtered or unexported fields
}

func NewDatamesh

func NewDatamesh(cf *Config) *Datamesh
func (self *Datamesh) DialLink(id string, endpoint transport.Address) (Link, error)

func (*Datamesh) InsertNIC

func (self *Datamesh) InsertNIC(circuitId Circuit, endpoint Endpoint) (NIC, error)

func (*Datamesh) Start

func (self *Datamesh) Start()

type Destination

type Destination interface {
	Address() Address
	FromNetwork(data *Payload) error
	Close() error
}

type Dialer

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

func NewDialer

func NewDialer(cfg *DialerConfig, id *identity.TokenId) *Dialer

func (*Dialer) Dial

func (self *Dialer) Dial(datamesh *Datamesh, endpoint transport.Address) (*link, error)

type DialerConfig

type DialerConfig struct {
	Id          string
	BindAddress transport.Address
	LinkConfig  *LinkConfig
}

func DialerConfigDefaults

func DialerConfigDefaults() *DialerConfig

type Endpoint

type Endpoint interface {
	Connect(txer EndpointTxer) error
	dilithium.Sink
}

Endpoint defines the primary "extensible" component in datamesh. An Endpoint sits inside of a NIC, which allows it to communicate with another NIC, and its contained Endpoint elsewhere on the network.

type EndpointTxer

type EndpointTxer interface {
	Tx(data []byte) error
}

EndpointTxer defines the transmitter interface exposed to an Endpoint.

type Forwarder

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

func (*Forwarder) AddDestination

func (fw *Forwarder) AddDestination(d Destination)

func (*Forwarder) AddRoute

func (fw *Forwarder) AddRoute(circuitId Circuit, srcAddr, destAddr Address)

func (*Forwarder) Forward

func (fw *Forwarder) Forward(srcAddr Address, payload *Payload) error

func (*Forwarder) RemoveDestination

func (fw *Forwarder) RemoveDestination(d Destination)

func (*Forwarder) RemoveRoute

func (fw *Forwarder) RemoveRoute(circuitId Circuit, srcAddr Address)

type Handlers

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

func (*Handlers) AddLinkDownHandler

func (handlers *Handlers) AddLinkDownHandler(h LinkDownHandler)

func (*Handlers) AddLinkUpHandler

func (handlers *Handlers) AddLinkUpHandler(h LinkUpHandler)

type HeaderKey

type HeaderKey uint32
type Link interface {
	Destination
	Start() error
	Peer() *identity.TokenId
	Direction() LinkDirection
	SendControl(c *Control) error
}

type LinkConfig

type LinkConfig struct {
	PingPeriod      time.Duration
	PingQueueLength int
	MTU             uint32
}

func LinkConfigDefaults

func LinkConfigDefaults() *LinkConfig

type LinkDirection

type LinkDirection int8
const (
	InboundLink  LinkDirection = 0
	OutboundLink LinkDirection = 1
)

type LinkDownHandler

type LinkDownHandler func(Link)

LinkDownHandler is invoked whenever a link goes down

type LinkUpHandler

type LinkUpHandler func(Link)

LinkUpHandler is invoked whenever a new link is brought up

type Listener

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

func NewListener

func NewListener(cfg *ListenerConfig, id *identity.TokenId) *Listener

func (*Listener) Listen

func (self *Listener) Listen(datamesh *Datamesh, incoming chan<- *link)

type ListenerConfig

type ListenerConfig struct {
	Id            string
	BindAddress   transport.Address
	Advertisement transport.Address
	LinkConfig    *LinkConfig
}

func ListenerConfigDefaults

func ListenerConfigDefaults() *ListenerConfig

type NIC

type NIC interface {
	Destination
}

type NICAdapter

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

func NewNICAdapter

func NewNICAdapter(nic NIC) *NICAdapter

func (*NICAdapter) Close

func (na *NICAdapter) Close() error

func (*NICAdapter) Read

func (na *NICAdapter) Read(p []byte) (n int, err error)

func (*NICAdapter) Write

func (na *NICAdapter) Write(p []byte) (n int, err error)

type Overlay

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

type Payload

type Payload struct {
	CircuitId Circuit
	Buf       *dilithium.Buffer
}

func NewPayload

func NewPayload(circuitId Circuit) *Payload

func UnmarshalPayload

func UnmarshalPayload(msg *channel.Message, pool *dilithium.Pool) (*Payload, error)

func (*Payload) Marshal

func (self *Payload) Marshal() *channel.Message

type PayloadFlag

type PayloadFlag uint32

type ProxyFactory

type ProxyFactory interface {
	Create() (Endpoint, error)
	Circuit() Circuit
}

type ProxyListener

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

func NewProxyListener

func NewProxyListener(bindAddress transport.Address) *ProxyListener

func (*ProxyListener) Accept

func (pxl *ProxyListener) Accept(data []byte) error

func (*ProxyListener) Close

func (pxl *ProxyListener) Close()

func (*ProxyListener) Connect

func (pxl *ProxyListener) Connect(txq EndpointTxer) error

type ProxyListenerFactory

type ProxyListenerFactory struct {
	BindAddress transport.Address
	CircuitId   Circuit
}

func (*ProxyListenerFactory) Circuit

func (pxlf *ProxyListenerFactory) Circuit() Circuit

func (*ProxyListenerFactory) Create

func (pxlf *ProxyListenerFactory) Create() (Endpoint, error)

type ProxyTerminator

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

func NewProxyTerminator

func NewProxyTerminator(dialAddress transport.Address) *ProxyTerminator

func (*ProxyTerminator) Accept

func (pxt *ProxyTerminator) Accept(data []byte) error

func (*ProxyTerminator) Close

func (pxt *ProxyTerminator) Close()

func (*ProxyTerminator) Connect

func (pxt *ProxyTerminator) Connect(txq EndpointTxer) error

type ProxyTerminatorFactory

type ProxyTerminatorFactory struct {
	DialAddress transport.Address
	CircuitId   Circuit
}

func (*ProxyTerminatorFactory) Circuit

func (pxtf *ProxyTerminatorFactory) Circuit() Circuit

func (*ProxyTerminatorFactory) Create

func (pxtf *ProxyTerminatorFactory) Create() (Endpoint, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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