router

package
v0.0.0-...-3b51f2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodePersistence func([]Node)

NodePersistence just prevent import cycle

Functions

func AddNodes

func AddNodes(ns []Node)

func EditNodes

func EditNodes(op func(ns []Node) []Node)

func GetHop

func GetHop(id string) (netip.AddrPort, error)

func SetNodes

func SetNodes(ns []Node)

func UpdateLinkStates

func UpdateLinkStates(infos ...LinkStates)

UpdateLinkStates Update the latency between nodes All link from the node included in the infos will be cleared before update

Types

type LinkState

type LinkState struct {
	From    string `json:"u"`
	To      string `json:"v"`
	Latency int    `json:"w"`
}

type LinkStates

type LinkStates = []LinkState

func EstimateAndStoreLatencies

func EstimateAndStoreLatencies() LinkStates

EstimateAndStoreLatencies Estimate the latency between nodes and store it in the router info

func EstimateLatencies

func EstimateLatencies(nodes []Node, from string) LinkStates

func GetLinkStates

func GetLinkStates() LinkStates

type Node

type Node struct {
	Id       string
	AddrPort netip.AddrPort
}

func FlattedNodes

func FlattedNodes() []Node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL