Documentation ¶
Overview ¶
Package graph and sub-packages contain a virtual representation of a graph of connected networks and nodes. Utilities to simulate these virtual graphs exist in other packages in this repo.
Index ¶
- type Edge
- type FactoryAdder
- type FactoryCtor
- type Graph
- func (g *Graph) AddEdge(edge Edge)
- func (g *Graph) AddNode(node Node)
- func (g *Graph) AllEdges() []Edge
- func (g *Graph) AllNodes() []Node
- func (g *Graph) AllPeers() []*Peer
- func (g *Graph) BuildEdge(from, to graph.Node) graph.Edge
- func (g *Graph) BuildNode() Node
- func (g *Graph) From(node Node) graph.Nodes
- func (g *Graph) FromNodes(node Node) []Node
- func (g *Graph) ShortestPath(n1, n2 Node) []Node
- func (g *Graph) Subgraph(node Node) []graph.Node
- type LAN
- type Node
- type Peer
- func (p *Peer) AddConfig(id string, conf config.Config)
- func (p *Peer) AddControllerConfig(id string, conf configset.ControllerConfig)
- func (p *Peer) AddFactory(ct FactoryCtor)
- func (p *Peer) AddFactoryAdder(ct FactoryAdder)
- func (p *Peer) DeleteConfig(id string)
- func (p *Peer) GetConfigSet() configset.ConfigSet
- func (p *Peer) GetExtraFactories() []FactoryCtor
- func (p *Peer) GetExtraFactoryAdders() []FactoryAdder
- func (p *Peer) GetLinkedPeers(g *Graph) []*Peer
- func (p *Peer) GetPeerID() peer.ID
- func (p *Peer) GetPeerPriv() crypto.PrivKey
- func (p *Peer) MergeConfigSet(other configset.ConfigSet)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FactoryAdder ¶
FactoryAdder is a adder for a factory.
type FactoryCtor ¶
type FactoryCtor func(bus.Bus) controller.Factory
FactoryCtor is a constructor for a factory.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is an instance of a graph of connected nodes.
func (*Graph) ShortestPath ¶
ShortestPath finds the shortest path between the two nodes. Returns 0 len slice if not found.
type LAN ¶
type LAN struct {
Node
}
LAN connects together machines and networks with implied many-to-many links. This simulates a wireless network, for example.
func (*LAN) AddConnectionToLAN ¶
AddConnectionToLAN adds a connection to another lan.
func (*LAN) GetAssociatedPeers ¶
GetAssociatedPeers returns all peers directly linked to the lan.
type Peer ¶
type Peer struct { Node // contains filtered or unexported fields }
Peer is a participating peer in the network. This corresponds to a controller bus and an inproc transport.
func GenerateAddPeer ¶
GenerateAddPeer generates a peer private key and adds it.
func (*Peer) AddControllerConfig ¶
func (p *Peer) AddControllerConfig(id string, conf configset.ControllerConfig)
AddControllerConfig adds a controller configuration to the peer.
func (*Peer) AddFactory ¶
func (p *Peer) AddFactory(ct FactoryCtor)
AddFactory adds a factory constructor to the set.
func (*Peer) AddFactoryAdder ¶
func (p *Peer) AddFactoryAdder(ct FactoryAdder)
AddFactoryAdder adds a factory adder to the set.
func (*Peer) DeleteConfig ¶
DeleteConfig removes a configuration from the configset with id.
func (*Peer) GetConfigSet ¶
GetConfigSet returns the extra controllers config set.
func (*Peer) GetExtraFactories ¶
func (p *Peer) GetExtraFactories() []FactoryCtor
GetExtraFactories returns the slice of extra factories.
func (*Peer) GetExtraFactoryAdders ¶
func (p *Peer) GetExtraFactoryAdders() []FactoryAdder
GetExtraFactoryAdders returns the slice of extra factory adders.
func (*Peer) GetLinkedPeers ¶
GetLinkedPeers returns all peers that should have a link with the peer. This includes other peers directly linked as well as those linked by a lan or multiple lans.
func (*Peer) GetPeerPriv ¶
GetPeerPriv returns the peer private key.
func (*Peer) MergeConfigSet ¶
MergeConfigSet merges in a configset to the extra controllers set.