chore: Add comments to indicate what each field on a network node means (#4241)

* chore: Add comments to indicate what each field on a network node means

* Update tailnet/coordinator.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

* Update tailnet/coordinator.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

* Update tailnet/coordinator.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

Co-authored-by: Colin Adler <colin1adler@gmail.com>
This commit is contained in:
Kyle Carberry 2022-09-28 11:04:10 -05:00 committed by GitHub
parent 518f6960d0
commit 6c83012082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 8 deletions

View File

@ -16,14 +16,25 @@ import (
// Node represents a node in the network.
type Node struct {
ID tailcfg.NodeID `json:"id"`
Key key.NodePublic `json:"key"`
DiscoKey key.DiscoPublic `json:"disco"`
PreferredDERP int `json:"preferred_derp"`
DERPLatency map[string]float64 `json:"derp_latency"`
Addresses []netip.Prefix `json:"addresses"`
AllowedIPs []netip.Prefix `json:"allowed_ips"`
Endpoints []string `json:"endpoints"`
// ID is used to identify the connection.
ID tailcfg.NodeID `json:"id"`
// Key is the Wireguard public key of the node.
Key key.NodePublic `json:"key"`
// DiscoKey is used for discovery messages over DERP to establish peer-to-peer connections.
DiscoKey key.DiscoPublic `json:"disco"`
// PreferredDERP is the DERP server that peered connections
// should meet at to establish.
PreferredDERP int `json:"preferred_derp"`
// DERPLatency is the latency in seconds to each DERP server.
DERPLatency map[string]float64 `json:"derp_latency"`
// Addresses are the IP address ranges this connection exposes.
Addresses []netip.Prefix `json:"addresses"`
// AllowedIPs specify what addresses can dial the connection.
// We allow all by default.
AllowedIPs []netip.Prefix `json:"allowed_ips"`
// Endpoints are ip:port combinations that can be used to establish
// peer-to-peer connections.
Endpoints []string `json:"endpoints"`
}
// ServeCoordinator matches the RW structure of a coordinator to exchange node messages.