mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Link costing based on average RTT (#1171)
This PR updates Ironwood to include the new RTT-based link costing and updates `yggdrasilctl` to report the cost in `getPeers`. Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
parent
947b6ad7aa
commit
c4b29b735c
8 changed files with 19 additions and 18 deletions
|
@ -24,6 +24,7 @@ type PeerEntry struct {
|
|||
PublicKey string `json:"key"`
|
||||
Port uint64 `json:"port"`
|
||||
Priority uint64 `json:"priority"`
|
||||
Cost uint64 `json:"cost"`
|
||||
RXBytes DataUnit `json:"bytes_recvd,omitempty"`
|
||||
TXBytes DataUnit `json:"bytes_sent,omitempty"`
|
||||
Uptime float64 `json:"uptime,omitempty"`
|
||||
|
@ -41,6 +42,7 @@ func (a *AdminSocket) getPeersHandler(_ *GetPeersRequest, res *GetPeersResponse)
|
|||
Up: p.Up,
|
||||
Inbound: p.Inbound,
|
||||
Priority: uint64(p.Priority), // can't be uint8 thanks to gobind
|
||||
Cost: p.Cost,
|
||||
URI: p.URI,
|
||||
RXBytes: DataUnit(p.RXBytes),
|
||||
TXBytes: DataUnit(p.TXBytes),
|
||||
|
|
|
@ -30,6 +30,7 @@ type PeerInfo struct {
|
|||
Coords []uint64
|
||||
Port uint64
|
||||
Priority uint8
|
||||
Cost uint64
|
||||
RXBytes uint64
|
||||
TXBytes uint64
|
||||
Uptime time.Duration
|
||||
|
@ -94,6 +95,7 @@ func (c *Core) GetPeers() []PeerInfo {
|
|||
peerinfo.Port = p.Port
|
||||
peerinfo.Priority = p.Priority
|
||||
peerinfo.Latency = p.Latency
|
||||
peerinfo.Cost = p.Cost
|
||||
}
|
||||
peers = append(peers, peerinfo)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue