Skip to content

Commit 41db1d7

Browse files
committed
tailcfg: deprecate Debug, flesh out Node.DERP docs
Updates #docs Signed-off-by: Brad Fitzpatrick <[email protected]>
1 parent 907c56c commit 41db1d7

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

tailcfg/tailcfg.go

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,20 @@ type Node struct {
213213
Addresses []netip.Prefix // IP addresses of this Node directly
214214
AllowedIPs []netip.Prefix // range of IP addresses to route to this node
215215
Endpoints []string `json:",omitempty"` // IP+port (public via STUN, and local LANs)
216-
DERP string `json:",omitempty"` // DERP-in-IP:port ("127.3.3.40:N") endpoint
217-
Hostinfo HostinfoView
218-
Created time.Time
219-
Cap CapabilityVersion `json:",omitempty"` // if non-zero, the node's capability version; old servers might not send
216+
217+
// DERP is this node's home DERP region ID integer, but shoved into an
218+
// IP:port string for legacy reasons. The IP address is always "127.3.3.40"
219+
// (a loopback address (127) followed by the digits over the letters DERP on
220+
// a QWERTY keyboard (3.3.40)). The "port number" is the home DERP region ID
221+
// integer.
222+
//
223+
// TODO(bradfitz): simplify this legacy mess; add a new HomeDERPRegionID int
224+
// field behind a new capver bump.
225+
DERP string `json:",omitempty"` // DERP-in-IP:port ("127.3.3.40:N") endpoint
226+
227+
Hostinfo HostinfoView
228+
Created time.Time
229+
Cap CapabilityVersion `json:",omitempty"` // if non-zero, the node's capability version; old servers might not send
220230

221231
// Tags are the list of ACL tags applied to this node.
222232
// Tags take the form of `tag:<value>` where value starts
@@ -677,11 +687,12 @@ type NetInfo struct {
677687
// Empty means not checked.
678688
PCP opt.Bool
679689

680-
// PreferredDERP is this node's preferred DERP server
681-
// for incoming traffic. The node might be be temporarily
682-
// connected to multiple DERP servers (to send to other nodes)
683-
// but PreferredDERP is the instance number that the node
684-
// subscribes to traffic at.
690+
// PreferredDERP is this node's preferred (home) DERP region ID.
691+
// This is where the node expects to be contacted to begin a
692+
// peer-to-peer connection. The node might be be temporarily
693+
// connected to multiple DERP servers (to speak to other nodes
694+
// that are located elsewhere) but PreferredDERP is the region ID
695+
// that the node subscribes to traffic at.
685696
// Zero means disconnected or unknown.
686697
PreferredDERP int
687698

@@ -1616,8 +1627,15 @@ type ControlIPCandidate struct {
16161627
Priority int `json:",omitempty"`
16171628
}
16181629

1619-
// Debug are instructions from the control server to the client
1620-
// to adjust debug settings.
1630+
// Debug are instructions from the control server to the client to adjust debug
1631+
// settings.
1632+
//
1633+
// Deprecated: these should no longer be used. They're a weird mix of declartive
1634+
// and imperative. The imperative ones should be c2n requests instead, and the
1635+
// declarative ones (at least the bools) should generally be self
1636+
// Node.Capabilities.
1637+
//
1638+
// TODO(bradfitz): start migrating the imperative ones to c2n requests.
16211639
type Debug struct {
16221640
// LogHeapPprof controls whether the client should log
16231641
// its heap pprof data. Each true value sent from the server

0 commit comments

Comments
 (0)