overlay

package
v0.0.0-...-7035aeb Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrap

type Bootstrap interface {
	Join(id string) string
	NewId() string
}

A bootstraping mechanism which provides a contact node for a newly arrived node. It is also used to expose new ids for nodes via the function NewId.

type ChanMap

type ChanMap struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func (*ChanMap) Chan

func (mp *ChanMap) Chan(id string) DirectConnector

func (*ChanMap) Join

func (mp *ChanMap) Join(id string) string

func (*ChanMap) NewId

func (mp *ChanMap) NewId() string

type DirectChan

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

An DirectChan implements a DirectConnector by using channels directly.

func (*DirectChan) Chan

func (d *DirectChan) Chan() chan interface{}

func (*DirectChan) ControlPing

func (d *DirectChan) ControlPing(id string) bool

func (*DirectChan) ControlRecv

func (d *DirectChan) ControlRecv() <-chan interface{}

func (*DirectChan) ControlSend

func (d *DirectChan) ControlSend(dst string, msg interface{})

type DirectConnector

type DirectConnector interface {
	interfaces.ControlTransport

	Chan() chan interface{}
}

func NewDirectChan

func NewDirectChan(
	networkMap DirectMap,
) (DirectConnector, string)

type DirectMap

type DirectMap interface {
	Bootstrap

	Chan(id string) DirectConnector
}

func NewChanMap

func NewChanMap() DirectMap

type LatencyConnector

type LatencyConnector interface {
	Observer() ActiveObserver

	interfaces.ControlTransport
}

A LatencyConnector is an interface which allows sending and receiving packets. Moreover, the interface allows access to an ActiveObserver which can be used to react to packet receival.

func NewUnderlayChan

func NewUnderlayChan(
	id string,
	simulation *underlay.NetworkSimulation,
	networkMap LatencyMap,
) LatencyConnector

type LatencyMap

type LatencyMap interface {
	Bootstrap

	Router(id string) underlay.Router // ID -> underlay.Router
	Id(router underlay.Router) string // underlay.Router -> ID
}

The LatencyMap provides a bootstraping mechanism along with an ID allocation mechanism and ID - router translation functions.

func NewNetworkMap

func NewNetworkMap(network *underlay.Network) LatencyMap

type NetworkMap

type NetworkMap struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

The NetworkMap is the implementation of the LatencyMap. It uses two maps for translating between ids and rounters(and viceversa). Since it can be accessed by multiple threads at the same time, the access is protected via a read-write mutex.

func (*NetworkMap) Id

func (mp *NetworkMap) Id(router underlay.Router) string

func (*NetworkMap) Join

func (mp *NetworkMap) Join(id string) string

func (*NetworkMap) NewId

func (mp *NetworkMap) NewId() string

func (*NetworkMap) Router

func (mp *NetworkMap) Router(id string) underlay.Router

type UnderlayChan

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

The UnderlayChan implements a LatencyConnector by using a proxy to strip the payload of the underlay packets at receiving a packet and sending a packet is done by using the network map to decorate the overlay packet inside an underlay packet.

The mechanism used for delivering packets is a PassiveObserver attached to the router corresponing to the overlay id.

func (*UnderlayChan) ControlPing

func (u *UnderlayChan) ControlPing(id string) bool

func (*UnderlayChan) ControlRecv

func (u *UnderlayChan) ControlRecv() <-chan interface{}

func (*UnderlayChan) ControlSend

func (u *UnderlayChan) ControlSend(dst string, msg interface{})

func (*UnderlayChan) Observer

func (u *UnderlayChan) Observer() ActiveObserver

func (*UnderlayChan) ReceiveEvent

func (u *UnderlayChan) ReceiveEvent(m interface{}) interface{}

Proxy function used to strip the contents of an underlay packet. The UnderlayChan chan is a Decorator, so we call the Proxy function before delivering the packet.

Jump to

Keyboard shortcuts

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