Documentation ¶
Index ¶
- Variables
- func GetHub(ID string) *hub.Hub
- func InitializeNavigator()
- func IsPortTrusted(port *Port) bool
- func Optimize(self *hub.Hub) (connectTo *hub.Hub, err error)
- func RemovePublicHub(id string)
- func SetPrimaryPort(port *Port)
- func UpdateHub(h *hub.Hub)
- func UpdateTrustedPorts(list map[string]struct{})
- type Map
- type Port
- func (p *Port) ActiveCost() int
- func (p *Port) ActiveRouteCost() int
- func (p *Port) AddPortDependent(dependentPort *Port)
- func (p *Port) AddRoute(newPort *Port, cost int)
- func (p *Port) CheckLocation()
- func (p *Port) CheckTrustStatus()
- func (p *Port) Cost() int
- func (p *Port) Equal(other *Port) bool
- func (p *Port) HasActiveRoute() bool
- func (p *Port) Ignored() bool
- func (p *Port) Name() string
- func (p *Port) RemovePortDependent(dependentPort *Port)
- func (p *Port) RemoveRoute(newPort *Port)
- func (p *Port) String() string
- func (p *Port) UpdateLoad(load int)
- type ProximityCollection
- type ProximityResult
- type Route
- type Solution
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrIAmLonely = errors.New("could not find any ports")
)
Functions ¶
func InitializeNavigator ¶
func InitializeNavigator()
InitializeNavigator loads all Hubs and adds them to the navigator.
func IsPortTrusted ¶
func RemovePublicHub ¶
func RemovePublicHub(id string)
func SetPrimaryPort ¶
func SetPrimaryPort(port *Port)
SetPrimaryPort sets the primary port for map calculations
func UpdateTrustedPorts ¶
func UpdateTrustedPorts(list map[string]struct{})
Types ¶
type Map ¶
type Map struct { Collection map[string]*Port CollectionLock sync.Locker PrimaryPort *Port GoodEnough int IgnoreAbove int // contains filtered or unexported fields }
Dijkstra "#AI"
func (*Map) FindNearestPorts ¶
func (m *Map) FindNearestPorts(ips []net.IP) (*ProximityCollection, error)
FindNearestPorts returns the nearest ports to a set of IP addresses.
func (*Map) FindShortestPath ¶
type Port ¶
type Port struct { sync.RWMutex Hub *hub.Hub IgnoreUntil int64 // e.g. if an error occurred with this port Trusted bool Location4 *geoip.Location Location6 *geoip.Location Routes []*Route ActiveAPI *docks.API // API to active Port ActiveRoute []*Port // list of Ports this connection runs through DependingPorts []*Port // list of Ports that use this Port for a connection Load int // estimated in microseconds this port adds to latency }
Port represents a node in the Port17 network.
func FindPathToPorts ¶
func GetPublicPort ¶
func GetRandomPort ¶ added in v0.2.1
func GetRandomPort() *Port
func (*Port) ActiveCost ¶
func (*Port) ActiveRouteCost ¶
func (*Port) AddPortDependent ¶
func (*Port) CheckLocation ¶
func (p *Port) CheckLocation()
func (*Port) CheckTrustStatus ¶
func (p *Port) CheckTrustStatus()
func (*Port) HasActiveRoute ¶
func (*Port) RemovePortDependent ¶
func (*Port) RemoveRoute ¶
func (*Port) UpdateLoad ¶
type ProximityCollection ¶
type ProximityCollection struct { All []*ProximityResult MinProximity int }
func FindNearestPorts ¶
func FindNearestPorts(ips []net.IP) (*ProximityCollection, error)
FindNearestPorts returns the nearest ports to a set of IP addresses.
func NewProximityCollection ¶
func NewProximityCollection(elements int) *ProximityCollection
func (*ProximityCollection) Add ¶
func (pc *ProximityCollection) Add(result *ProximityResult)
func (*ProximityCollection) Clean ¶
func (pc *ProximityCollection) Clean()
func (*ProximityCollection) Len ¶
func (pc *ProximityCollection) Len() int
Len is the number of elements in the collection.
func (*ProximityCollection) Less ¶
func (pc *ProximityCollection) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (*ProximityCollection) Swap ¶
func (pc *ProximityCollection) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type ProximityResult ¶
func (*ProximityResult) String ¶
func (pr *ProximityResult) String() string
type Solution ¶
func NewSolution ¶
func (*Solution) CalculateConnectCost ¶
func (*Solution) CalculateCost ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.