Documentation
¶
Index ¶
- Constants
- type APICommandID
- type APICommandMessageID
- type APIEventMessageID
- type APINodeType
- type APIUpdateID
- type AddNode
- type AddPeer
- 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) ManholeHandler(w http.ResponseWriter, req *http.Request)
- func (r *DefaultRouter) Ping(ctx context.Context, a net.Addr) (uint16, time.Duration, error)
- func (r *DefaultRouter) PublicKey() types.PublicKey
- func (r *DefaultRouter) Subscribe(ch chan events.Event)
- type Delay
- type Distance
- type EventSequencePlayer
- type EventSequenceRunner
- type InitialNodeState
- type InitialStateMsg
- type Node
- type NodeAdded
- type NodeRemoved
- type NodeState
- type Pause
- type PeerAdded
- type PeerInfo
- type PeerRemoved
- 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) CalculateShortestPaths(nodes map[string]struct{}, wires map[string]map[string]bool)
- 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) Node(t string) *Node
- func (sim *Simulator) Nodes() map[string]*Node
- func (sim *Simulator) Pause()
- func (sim *Simulator) PingSNEK(from, to string) (uint16, time.Duration, error)
- func (sim *Simulator) PingTree(from, to string) (uint16, time.Duration, error)
- func (sim *Simulator) PingingEnabled() bool
- func (sim *Simulator) Play()
- func (sim *Simulator) RemoveNode(node string)
- func (sim *Simulator) ReportDistance(a, b string, l int64, snek bool)
- func (sim *Simulator) SNEKPathConvergence() map[string]map[string]bool
- func (sim *Simulator) StartNodeEventHandler(t string, nodeType APINodeType)
- func (sim *Simulator) TreePathConvergence() map[string]map[string]bool
- func (sim *Simulator) Uptime() time.Duration
- type SnakeAscUpdate
- type SnakeDescUpdate
- type State
- type StateAccessor
- type StateDebug
- type StateUpdateMsg
- type TreeParentUpdate
- type TreeRootAnnUpdate
Constants ¶
View Source
const FAILURE_PREAMBLE = "Failed unmarshalling event: "
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 )
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 )
type AddNode ¶ added in v0.7.0
type AddNode struct {
Node string
NodeType APINodeType
}
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) ManholeHandler ¶ added in v0.8.0
func (r *DefaultRouter) ManholeHandler(w http.ResponseWriter, req *http.Request)
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 InitialNodeState ¶ added in v0.6.0
type InitialStateMsg ¶ added in v0.6.0
type InitialStateMsg struct {
MsgID APIEventMessageID
Nodes map[string]InitialNodeState
End bool
}
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
}
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 PeerRemoved ¶ added in v0.6.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 net.Addr) (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 NewSimulator ¶
func (*Simulator) AddToPlaylist ¶ added in v0.7.0
func (sim *Simulator) AddToPlaylist(commands []SimCommand)
func (*Simulator) CalculateShortestPaths ¶
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) PingingEnabled ¶ added in v0.4.0
func (*Simulator) RemoveNode ¶ added in v0.7.0
func (*Simulator) ReportDistance ¶
func (*Simulator) SNEKPathConvergence ¶ added in v0.2.0
func (*Simulator) StartNodeEventHandler ¶ added in v0.6.0
func (sim *Simulator) StartNodeEventHandler(t string, nodeType APINodeType)
func (*Simulator) TreePathConvergence ¶ added in v0.2.0
type SnakeAscUpdate ¶ added in v0.6.0
type SnakeDescUpdate ¶ added in v0.6.0
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 TreeParentUpdate ¶ added in v0.6.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.