Documentation
¶
Overview ¶
TODO: better name? network topology?
TODO: better name? network topology?
TODO: better name? network topology?
Index ¶
- Constants
- func CreatePuzzle(paths ...[]string) map[int]*pathMergePuzzlePiece
- func FillPath(path []string)
- func MergeRoutePath(o []string, n []string) ([]string, error)
- type Event
- type NetworkGraph
- func (g *NetworkGraph) DecrLink(src, dst string) (*NetworkLink, bool)
- func (g *NetworkGraph) DecrNode(name string) (*NetworkNode, bool)
- func (g *NetworkGraph) DecrRoute(hops []string) (*NetworkRoute, bool)
- func (g *NetworkGraph) EventDumpChannel() chan *Event
- func (g *NetworkGraph) GetLink(key string) *NetworkLink
- func (g *NetworkGraph) GetLinkCount() int
- func (g *NetworkGraph) GetNode(name string) *NetworkNode
- func (g *NetworkGraph) GetNodeCount() int
- func (g *NetworkGraph) GetRoute(hops []string) *NetworkRoute
- func (g *NetworkGraph) GetRouteCount() int
- func (g *NetworkGraph) IncrLink(src, dst string, newLink *NetworkLink) (*NetworkLink, bool)
- func (g *NetworkGraph) IncrNode(name string, newNode *NetworkNode) (*NetworkNode, bool)
- func (g *NetworkGraph) IncrRoute(hops []string, newRoute *NetworkRoute) (*NetworkRoute, bool)
- func (g *NetworkGraph) Subscribe(c chan *Event)
- type NetworkLink
- type NetworkNode
- type NetworkRoute
- func (r *NetworkRoute) HandleACK(pass bool, latency int64)
- func (r *NetworkRoute) Hops() []string
- func (r *NetworkRoute) Inherit(o *NetworkRoute)
- func (r *NetworkRoute) Key() string
- func (r *NetworkRoute) MarshalJSON() ([]byte, error)
- func (r *NetworkRoute) SamePath(path []string) bool
- func (r *NetworkRoute) SamePathReverse(path []string) bool
- func (r *NetworkRoute) UnmarshalJSON(data []byte) error
- type RoutePingResponse
Constants ¶
const ( Up graphState = iota Suspect Down )
const UNKNOWN_PATH = "*"
Variables ¶
This section is empty.
Functions ¶
func CreatePuzzle ¶
Create a "puzzle" for the N constrained list of paths
Types ¶
type Event ¶
type Event struct { E eventType // Pointer to the thing that changed Item interface{} }
type NetworkGraph ¶
type NetworkGraph struct { // nodeName -> Node NodesMap map[string]*NetworkNode `json:"nodes"` NodesLock *sync.RWMutex `json:"-"` // nodeName,nodeName -> NetworkLink LinksMap map[string]*NetworkLink `json:"edges"` LinksLock *sync.RWMutex `json:"-"` RoutesMap map[string]*NetworkRoute `json:"routes"` RoutesLock *sync.RWMutex `json:"-"` // contains filtered or unexported fields }
func Create ¶
func Create() *NetworkGraph
func (*NetworkGraph) DecrLink ¶
func (g *NetworkGraph) DecrLink(src, dst string) (*NetworkLink, bool)
func (*NetworkGraph) DecrNode ¶
func (g *NetworkGraph) DecrNode(name string) (*NetworkNode, bool)
func (*NetworkGraph) DecrRoute ¶
func (g *NetworkGraph) DecrRoute(hops []string) (*NetworkRoute, bool)
func (*NetworkGraph) EventDumpChannel ¶
func (g *NetworkGraph) EventDumpChannel() chan *Event
TODO: locking here Dump everything in the NetworkGraph into a channel
func (*NetworkGraph) GetLink ¶
func (g *NetworkGraph) GetLink(key string) *NetworkLink
func (*NetworkGraph) GetLinkCount ¶
func (g *NetworkGraph) GetLinkCount() int
func (*NetworkGraph) GetNode ¶
func (g *NetworkGraph) GetNode(name string) *NetworkNode
func (*NetworkGraph) GetNodeCount ¶
func (g *NetworkGraph) GetNodeCount() int
func (*NetworkGraph) GetRoute ¶
func (g *NetworkGraph) GetRoute(hops []string) *NetworkRoute
func (*NetworkGraph) GetRouteCount ¶
func (g *NetworkGraph) GetRouteCount() int
func (*NetworkGraph) IncrLink ¶
func (g *NetworkGraph) IncrLink(src, dst string, newLink *NetworkLink) (*NetworkLink, bool)
func (*NetworkGraph) IncrNode ¶
func (g *NetworkGraph) IncrNode(name string, newNode *NetworkNode) (*NetworkNode, bool)
func (*NetworkGraph) IncrRoute ¶
func (g *NetworkGraph) IncrRoute(hops []string, newRoute *NetworkRoute) (*NetworkRoute, bool)
func (*NetworkGraph) Subscribe ¶
func (g *NetworkGraph) Subscribe(c chan *Event)
add subscriber to our events
type NetworkLink ¶
type NetworkNode ¶
type NetworkNode struct { Name string `json:"name"` // asynchronously loaded DNSNames []string `json:"dns_names"` // contains filtered or unexported fields }
TODO: differentiate between peers and L3devices in the middle TODO: handle addr '*' -- to compensate maybe we can just use a compound of the node on either side? so something like A -> * -> * -> B would become A*_B (for the second *) TODO: maintain pointers to NetworkLink for traversal
func NewNetworkNode ¶
func NewNetworkNode(name string, updateChan chan *Event) *NetworkNode
func (*NetworkNode) MarshalJSON ¶
func (n *NetworkNode) MarshalJSON() ([]byte, error)
Fancy marshal method
func (*NetworkNode) UnmarshalJSON ¶
func (n *NetworkNode) UnmarshalJSON(data []byte) error
Fancy unmashal method
type NetworkRoute ¶
type NetworkRoute struct { Path []string `json:"path"` // Network statistics State graphState `json:"state"` // TODO: better handle in the serialization // contains filtered or unexported fields }
TODO: RoundTripRoute? Right now the Route is a single direction since we only have one side of the traceroute. If the peers gossip about the reverse routes then we could potentially have both directions TODO: TTL for routes? If we just start up we don't want to have to re-ping the world before we are useful TODO: stats about route health
func (*NetworkRoute) HandleACK ¶
func (r *NetworkRoute) HandleACK(pass bool, latency int64)
func (*NetworkRoute) Hops ¶
func (r *NetworkRoute) Hops() []string
func (*NetworkRoute) Inherit ¶
func (r *NetworkRoute) Inherit(o *NetworkRoute)
TODO: we make the assumption here that the other route goes away-- which since the only caller today is the merge stuff in mapper-- is safe. If that ever changes we'll need to be more careful here-- as we are just pointing at another ring-- which has its own pings going on
func (*NetworkRoute) Key ¶
func (r *NetworkRoute) Key() string
func (*NetworkRoute) MarshalJSON ¶
func (r *NetworkRoute) MarshalJSON() ([]byte, error)
Fancy marshal method
func (*NetworkRoute) SamePath ¶
func (r *NetworkRoute) SamePath(path []string) bool
func (*NetworkRoute) SamePathReverse ¶
func (r *NetworkRoute) SamePathReverse(path []string) bool
is this the same path, just in reverse?
func (*NetworkRoute) UnmarshalJSON ¶
func (r *NetworkRoute) UnmarshalJSON(data []byte) error
Fancy unmashal method
type RoutePingResponse ¶
TODO: measure jitter (diff between 2 packet sends)