Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bootstrap ¶
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 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 ¶
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) Join ¶
func (mp *NetworkMap) Join(id string) string
func (*NetworkMap) NewId ¶
func (mp *NetworkMap) NewId() string
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.