Documentation ¶
Index ¶
- Constants
- type APICommandID
- type APICommandMessageID
- type APIEventMessageID
- type APINodeType
- type APIUpdateID
- type AddNode
- type AddPeer
- type BandwidthReport
- type BandwidthReports
- type BandwidthSnapshot
- type BroadcastEntry
- type BroadcastReceived
- type ConfigureAdversaryDefaults
- type ConfigureAdversaryPeer
- type DefaultRouter
- func (r *DefaultRouter) ConfigureFilterDefaults(rates adversary.DropRates)
- func (r *DefaultRouter) ConfigureFilterPeer(peer types.PublicKey, rates adversary.DropRates)
- func (r *DefaultRouter) Connect(conn net.Conn, options ...router.ConnectionOption) (types.SwitchPortID, error)
- func (r *DefaultRouter) Coords() types.Coordinates
- func (r *DefaultRouter) DisableWakeupBroadcasts()
- func (r *DefaultRouter) EnableHopLimiting()
- func (r *DefaultRouter) EnableWakeupBroadcasts()
- func (r *DefaultRouter) ManholeHandler(w http.ResponseWriter, req *http.Request)
- func (r *DefaultRouter) OverlayReadHandler(quit <-chan bool)
- func (r *DefaultRouter) Ping(ctx context.Context, destination types.PublicKey) (uint16, time.Duration, error)
- func (r *DefaultRouter) PingFilter(from types.PublicKey, f *types.Frame) bool
- func (r *DefaultRouter) PublicKey() types.PublicKey
- func (r *DefaultRouter) Subscribe(ch chan events.Event)
- type Delay
- type Distance
- type EventSequencePlayer
- type EventSequenceRunner
- type ExpectedBroadcasts
- type InitialNodeState
- type InitialStateMsg
- type NetworkStatsUpdate
- type Node
- type NodeAdded
- type NodeRemoved
- type NodeState
- type Pause
- type PeerAdded
- type PeerBandwidthUsage
- type PeerInfo
- type PeerRemoved
- type PingPayload
- type PingStateUpdate
- type PingType
- type Play
- type RemoveNode
- type RemovePeer
- type RootAnnouncement
- type RootState
- type RouterCreatorFn
- type SimCommand
- type SimCommandMsg
- type SimCommandSequenceMsg
- type SimEvent
- type SimEventMsg
- type SimRouter
- type Simulator
- func (sim *Simulator) AddToPlaylist(commands []SimCommand)
- func (sim *Simulator) CalculatePathConvergence() float64
- func (sim *Simulator) CalculateStretch() float64
- func (sim *Simulator) ConfigureFilterDefaults(node string, rates adversary.DropRates)
- func (sim *Simulator) ConfigureFilterPeer(node string, peer string, rates adversary.DropRates)
- func (sim *Simulator) ConnectNodes(a, b string) error
- func (sim *Simulator) CreateNode(t string, nodeType APINodeType) error
- func (sim *Simulator) DisconnectAllPeers(disconnectNode string)
- func (sim *Simulator) DisconnectNodes(a, b string) error
- func (sim *Simulator) Distances() map[string]map[string]*Distance
- func (sim *Simulator) GenerateNetworkGraph()
- func (sim *Simulator) Node(t string) *Node
- func (sim *Simulator) Nodes() map[string]*Node
- func (sim *Simulator) PathConvergence() map[string]map[string]bool
- func (sim *Simulator) Pause()
- func (sim *Simulator) Ping(from, to string) (uint16, time.Duration, error)
- func (sim *Simulator) PingingActive() bool
- func (sim *Simulator) PingingEnabled() bool
- func (sim *Simulator) Play()
- func (sim *Simulator) RemoveNode(node string)
- func (sim *Simulator) ReportDistance(a, b string, l int64)
- func (sim *Simulator) StartNodeEventHandler(t string, nodeType APINodeType)
- func (sim *Simulator) StartPinging(ping_period time.Duration)
- func (sim *Simulator) StartPings()
- func (sim *Simulator) StopPings()
- func (sim *Simulator) UpdateRealDistances()
- func (sim *Simulator) Uptime() time.Duration
- type SnakeAscUpdate
- type SnakeDescUpdate
- type SnakeEntryAdded
- type SnakeEntryRemoved
- type SnakeRouteEntry
- type StartPings
- type State
- type StateAccessor
- type StateDebug
- type StateUpdateMsg
- type StopPings
- type TreeParentUpdate
- type TreeRootAnnUpdate
Constants ¶
View Source
const FAILURE_PREAMBLE = "Failed unmarshalling event: "
View Source
const MaxBandwidthReports = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICommandID ¶ added in v0.7.0
type APICommandID int
const ( UnknownCommand APICommandID = iota SimDebug SimPlay SimPause SimDelay SimAddNode SimRemoveNode SimAddPeer SimRemovePeer SimConfigureAdversaryDefaults SimConfigureAdversaryPeer SimStartPings SimStopPings )
type APICommandMessageID ¶ added in v0.7.0
type APICommandMessageID int
const ( UnknownCommandMsg APICommandMessageID = iota SimPlaySequence )
type APIEventMessageID ¶ added in v0.7.0
type APIEventMessageID int
const ( UnknownEventMsg APIEventMessageID = iota SimInitialState SimStateUpdate )
type APINodeType ¶ added in v0.7.0
type APINodeType int
const ( UnknownType APINodeType = iota DefaultNode GeneralAdversaryNode )
type APIUpdateID ¶ added in v0.6.0
type APIUpdateID int
const ( UnknownUpdate APIUpdateID = iota SimNodeAdded SimNodeRemoved SimPeerAdded SimPeerRemoved SimTreeParentUpdated SimSnakeAscUpdated SimSnakeDescUpdated SimTreeRootAnnUpdated SimSnakeEntryAdded SimSnakeEntryRemoved SimPingStateUpdated SimNetworkStatsUpdated SimBroadcastReceived SimBandwidthReport )
type AddNode ¶ added in v0.7.0
type AddNode struct { Node string NodeType APINodeType }
type BandwidthReport ¶ added in v0.10.0
type BandwidthReport struct { Node string Bandwidth BandwidthSnapshot }
type BandwidthReports ¶ added in v0.10.0
type BandwidthReports []BandwidthSnapshot
type BandwidthSnapshot ¶ added in v0.10.0
type BandwidthSnapshot struct { ReceiveTime uint64 Peers map[string]PeerBandwidthUsage }
type BroadcastEntry ¶ added in v0.11.0
type BroadcastReceived ¶ added in v0.11.0
type ConfigureAdversaryDefaults ¶ added in v0.7.0
func (ConfigureAdversaryDefaults) Run ¶ added in v0.7.0
func (c ConfigureAdversaryDefaults) Run(log *log.Logger, sim *Simulator)
Tag ConfigureAdversaryDefaults as an Command
func (ConfigureAdversaryDefaults) String ¶ added in v0.7.0
func (c ConfigureAdversaryDefaults) String() string
type ConfigureAdversaryPeer ¶ added in v0.7.0
func (ConfigureAdversaryPeer) Run ¶ added in v0.7.0
func (c ConfigureAdversaryPeer) Run(log *log.Logger, sim *Simulator)
Tag ConfigureAdversaryPeer as an Command
func (ConfigureAdversaryPeer) String ¶ added in v0.7.0
func (c ConfigureAdversaryPeer) String() string
type DefaultRouter ¶ added in v0.7.0
type DefaultRouter struct {
// contains filtered or unexported fields
}
func (*DefaultRouter) ConfigureFilterDefaults ¶ added in v0.7.0
func (r *DefaultRouter) ConfigureFilterDefaults(rates adversary.DropRates)
func (*DefaultRouter) ConfigureFilterPeer ¶ added in v0.7.0
func (r *DefaultRouter) ConfigureFilterPeer(peer types.PublicKey, rates adversary.DropRates)
func (*DefaultRouter) Connect ¶ added in v0.7.0
func (r *DefaultRouter) Connect(conn net.Conn, options ...router.ConnectionOption) (types.SwitchPortID, error)
func (*DefaultRouter) Coords ¶ added in v0.7.0
func (r *DefaultRouter) Coords() types.Coordinates
func (*DefaultRouter) DisableWakeupBroadcasts ¶ added in v0.11.0
func (r *DefaultRouter) DisableWakeupBroadcasts()
func (*DefaultRouter) EnableHopLimiting ¶ added in v0.11.0
func (r *DefaultRouter) EnableHopLimiting()
func (*DefaultRouter) EnableWakeupBroadcasts ¶ added in v0.11.0
func (r *DefaultRouter) EnableWakeupBroadcasts()
func (*DefaultRouter) ManholeHandler ¶ added in v0.8.0
func (r *DefaultRouter) ManholeHandler(w http.ResponseWriter, req *http.Request)
func (*DefaultRouter) OverlayReadHandler ¶ added in v0.9.0
func (r *DefaultRouter) OverlayReadHandler(quit <-chan bool)
func (*DefaultRouter) PingFilter ¶ added in v0.10.0
func (*DefaultRouter) PublicKey ¶ added in v0.7.0
func (r *DefaultRouter) PublicKey() types.PublicKey
func (*DefaultRouter) Subscribe ¶ added in v0.7.0
func (r *DefaultRouter) Subscribe(ch chan events.Event)
type Delay ¶ added in v0.7.0
type Delay struct {
Length uint64 // delay time in ms
}
type EventSequencePlayer ¶ added in v0.7.0
type EventSequencePlayer interface { Play() Pause() AddToPlaylist(commands []SimCommand) }
type EventSequenceRunner ¶ added in v0.7.0
func (*EventSequenceRunner) Pause ¶ added in v0.7.0
func (r *EventSequenceRunner) Pause()
func (*EventSequenceRunner) Play ¶ added in v0.7.0
func (r *EventSequenceRunner) Play()
func (*EventSequenceRunner) Run ¶ added in v0.7.0
func (r *EventSequenceRunner) Run(sim *Simulator)
type ExpectedBroadcasts ¶ added in v0.11.0
type InitialNodeState ¶ added in v0.6.0
type InitialNodeState struct { PublicKey string NodeType APINodeType RootState RootState Peers []PeerInfo TreeParent string SnakeAsc string SnakeAscPath string SnakeDesc string SnakeDescPath string SnakeEntries []SnakeRouteEntry BroadcastsReceived []BroadcastEntry BandwidthReports []BandwidthSnapshot }
type InitialStateMsg ¶ added in v0.6.0
type InitialStateMsg struct { MsgID APIEventMessageID Nodes map[string]InitialNodeState End bool BWReportingInterval int }
type NetworkStatsUpdate ¶ added in v0.9.0
type Node ¶
type Node struct { SimRouter ListenAddr *net.TCPAddr Type APINodeType // contains filtered or unexported fields }
type NodeRemoved ¶ added in v0.6.0
type NodeRemoved struct {
Node string
}
type NodeState ¶ added in v0.6.0
type NodeState struct { PeerID string NodeType APINodeType Connections map[int]string Parent string Coords []uint64 Announcement RootAnnouncement AscendingPeer string AscendingPathID string DescendingPeer string DescendingPathID string SnakeEntries map[string]string BroadcastsReceived map[string]uint64 BandwidthReports BandwidthReports NextReportIndex uint ExpectedBroadcasts ExpectedBroadcasts }
func NewNodeState ¶ added in v0.6.0
func NewNodeState(peerID string, nodeType APINodeType) *NodeState
type Pause ¶ added in v0.7.0
type Pause struct{}
type PeerBandwidthUsage ¶ added in v0.10.0
type PeerRemoved ¶ added in v0.6.0
type PingPayload ¶ added in v0.9.0
type PingPayload struct {
// contains filtered or unexported fields
}
func (*PingPayload) MarshalBinary ¶ added in v0.9.0
func (p *PingPayload) MarshalBinary(buffer []byte) (int, error)
func (*PingPayload) UnmarshalBinary ¶ added in v0.9.0
func (p *PingPayload) UnmarshalBinary(buffer []byte) (int, error)
type PingStateUpdate ¶ added in v0.9.0
type Play ¶ added in v0.7.0
type Play struct{}
type RemoveNode ¶ added in v0.7.0
type RemoveNode struct {
Node string
}
func (RemoveNode) Run ¶ added in v0.7.0
func (c RemoveNode) Run(log *log.Logger, sim *Simulator)
Tag RemoveNode as an Command
func (RemoveNode) String ¶ added in v0.7.0
func (c RemoveNode) String() string
type RemovePeer ¶ added in v0.7.0
func (RemovePeer) Run ¶ added in v0.7.0
func (c RemovePeer) Run(log *log.Logger, sim *Simulator)
Tag RemovePeer as an Command
func (RemovePeer) String ¶ added in v0.7.0
func (c RemovePeer) String() string
type RootAnnouncement ¶ added in v0.6.0
type RouterCreatorFn ¶ added in v0.7.0
type SimCommand ¶ added in v0.7.0
func UnmarshalCommandJSON ¶ added in v0.7.0
func UnmarshalCommandJSON(command *SimCommandMsg) (SimCommand, error)
type SimCommandMsg ¶ added in v0.7.0
type SimCommandMsg struct { MsgID APICommandID Event interface{} }
type SimCommandSequenceMsg ¶ added in v0.7.0
type SimCommandSequenceMsg struct { MsgID APICommandMessageID Events []SimCommandMsg }
type SimEvent ¶ added in v0.6.0
type SimEvent interface {
// contains filtered or unexported methods
}
type SimEventMsg ¶ added in v0.6.0
type SimEventMsg struct { UpdateID APIUpdateID Event SimEvent }
type SimRouter ¶ added in v0.7.0
type SimRouter interface { PublicKey() types.PublicKey Connect(conn net.Conn, options ...router.ConnectionOption) (types.SwitchPortID, error) Subscribe(ch chan events.Event) Ping(ctx context.Context, a types.PublicKey) (uint16, time.Duration, error) Coords() types.Coordinates ConfigureFilterDefaults(rates adversary.DropRates) ConfigureFilterPeer(peer types.PublicKey, rates adversary.DropRates) ManholeHandler(w http.ResponseWriter, req *http.Request) }
type Simulator ¶
type Simulator struct { AcceptCommands bool State *StateAccessor // contains filtered or unexported fields }
func (*Simulator) AddToPlaylist ¶ added in v0.7.0
func (sim *Simulator) AddToPlaylist(commands []SimCommand)
func (*Simulator) CalculatePathConvergence ¶ added in v0.10.0
func (*Simulator) CalculateStretch ¶ added in v0.9.0
func (*Simulator) ConfigureFilterDefaults ¶ added in v0.7.0
func (*Simulator) ConfigureFilterPeer ¶ added in v0.7.0
func (*Simulator) ConnectNodes ¶
func (*Simulator) CreateNode ¶
func (sim *Simulator) CreateNode(t string, nodeType APINodeType) error
func (*Simulator) DisconnectAllPeers ¶ added in v0.7.0
func (*Simulator) DisconnectNodes ¶
func (*Simulator) GenerateNetworkGraph ¶ added in v0.11.0
func (sim *Simulator) GenerateNetworkGraph()
func (*Simulator) PathConvergence ¶
func (*Simulator) PingingActive ¶ added in v0.9.0
func (*Simulator) PingingEnabled ¶ added in v0.4.0
func (*Simulator) RemoveNode ¶ added in v0.7.0
func (*Simulator) ReportDistance ¶
func (*Simulator) StartNodeEventHandler ¶ added in v0.6.0
func (sim *Simulator) StartNodeEventHandler(t string, nodeType APINodeType)
func (*Simulator) StartPinging ¶ added in v0.9.0
func (*Simulator) StartPings ¶ added in v0.9.0
func (sim *Simulator) StartPings()
func (*Simulator) UpdateRealDistances ¶ added in v0.11.0
func (sim *Simulator) UpdateRealDistances()
type SnakeAscUpdate ¶ added in v0.6.0
type SnakeDescUpdate ¶ added in v0.6.0
type SnakeEntryAdded ¶ added in v0.9.0
type SnakeEntryRemoved ¶ added in v0.9.0
type SnakeRouteEntry ¶ added in v0.9.0
type StartPings ¶ added in v0.9.0
type StartPings struct{}
func (StartPings) Run ¶ added in v0.9.0
func (c StartPings) Run(log *log.Logger, sim *Simulator)
Tag StartPings as a Command
func (StartPings) String ¶ added in v0.9.0
func (c StartPings) String() string
type StateAccessor ¶ added in v0.6.0
func NewStateAccessor ¶ added in v0.6.0
func NewStateAccessor() *StateAccessor
func (*StateAccessor) DebugLog ¶ added in v0.7.0
func (s *StateAccessor) DebugLog() string
func (*StateAccessor) GetLinkCount ¶ added in v0.6.0
func (s *StateAccessor) GetLinkCount() float64
func (*StateAccessor) GetNodeCoords ¶ added in v0.6.0
func (s *StateAccessor) GetNodeCoords(name string) []uint64
func (*StateAccessor) GetNodeName ¶ added in v0.6.0
func (s *StateAccessor) GetNodeName(peerID string) (string, error)
func (*StateAccessor) Subscribe ¶ added in v0.6.0
func (s *StateAccessor) Subscribe(ch chan<- SimEvent) State
type StateDebug ¶ added in v0.7.0
type StateDebug struct{}
func (StateDebug) Run ¶ added in v0.7.0
func (c StateDebug) Run(log *log.Logger, sim *Simulator)
Tag StateDebug as a Command
func (StateDebug) String ¶ added in v0.7.0
func (c StateDebug) String() string
type StateUpdateMsg ¶ added in v0.6.0
type StateUpdateMsg struct { MsgID APIEventMessageID Event SimEventMsg }
type StopPings ¶ added in v0.9.0
type StopPings struct{}
type TreeParentUpdate ¶ added in v0.6.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.