From e9c0bc6af4847ec6d86a5fec4f2d1612b0acc62b Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 28 Sep 2022 15:21:01 +0000 Subject: [PATCH 1/4] chore: Add comments to indicate what each field on a network node means --- tailnet/coordinator.go | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tailnet/coordinator.go b/tailnet/coordinator.go index d6e8b6bbb6e59..a5a4930160d49 100644 --- a/tailnet/coordinator.go +++ b/tailnet/coordinator.go @@ -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 also used to identify the connection. + Key key.NodePublic `json:"key"` + // DiscoKey is used to establish a peer-to-peer connection. + 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 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. From f21781716df34e1347c852d8e10145d9af7035d9 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 28 Sep 2022 10:55:20 -0500 Subject: [PATCH 2/4] Update tailnet/coordinator.go Co-authored-by: Colin Adler --- tailnet/coordinator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailnet/coordinator.go b/tailnet/coordinator.go index a5a4930160d49..98a6278571a29 100644 --- a/tailnet/coordinator.go +++ b/tailnet/coordinator.go @@ -20,7 +20,7 @@ type Node struct { ID tailcfg.NodeID `json:"id"` // Key is also used to identify the connection. Key key.NodePublic `json:"key"` - // DiscoKey is used to establish a peer-to-peer connection. + // 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. From 5e2ea37f37731d7a77cfbdf7998be7efb39fff46 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 28 Sep 2022 10:55:24 -0500 Subject: [PATCH 3/4] Update tailnet/coordinator.go Co-authored-by: Colin Adler --- tailnet/coordinator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailnet/coordinator.go b/tailnet/coordinator.go index 98a6278571a29..ab8b006688474 100644 --- a/tailnet/coordinator.go +++ b/tailnet/coordinator.go @@ -18,7 +18,7 @@ import ( type Node struct { // ID is used to identify the connection. ID tailcfg.NodeID `json:"id"` - // Key is also used to identify the connection. + // 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"` From dcc1a2cf8c1cb8a9aedb675aafc3ddfcbcf84a82 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 28 Sep 2022 10:55:28 -0500 Subject: [PATCH 4/4] Update tailnet/coordinator.go Co-authored-by: Colin Adler --- tailnet/coordinator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailnet/coordinator.go b/tailnet/coordinator.go index ab8b006688474..ee696b0925e3c 100644 --- a/tailnet/coordinator.go +++ b/tailnet/coordinator.go @@ -32,7 +32,7 @@ type Node struct { // AllowedIPs specify what addresses can dial the connection. // We allow all by default. AllowedIPs []netip.Prefix `json:"allowed_ips"` - // Endpoints are ip:port that can be used to establish + // Endpoints are ip:port combinations that can be used to establish // peer-to-peer connections. Endpoints []string `json:"endpoints"` }