From 6f521c138dc381b0404027d8f1eca96661ded73d Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Thu, 20 Apr 2023 10:21:46 -0400 Subject: [PATCH] tailcfg: add CanPort80 field to DERPNode A follow-up PR will start using this field after we set it in our production DERPMap. Updates #7925 Signed-off-by: Andrew Dunham Change-Id: Idb41b79e6055dddb8944f79d91ad4a186ace98c7 --- tailcfg/derpmap.go | 4 ++++ tailcfg/tailcfg_clone.go | 1 + tailcfg/tailcfg_view.go | 2 ++ 3 files changed, 7 insertions(+) diff --git a/tailcfg/derpmap.go b/tailcfg/derpmap.go index 1a22e8880..abc763e47 100644 --- a/tailcfg/derpmap.go +++ b/tailcfg/derpmap.go @@ -142,6 +142,10 @@ type DERPNode struct { // STUNTestIP is used in tests to override the STUN server's IP. // If empty, it's assumed to be the same as the DERP server. STUNTestIP string `json:",omitempty"` + + // CanPort80 specifies whether this DERP node is accessible over HTTP + // on port 80 specifically. This is used for captive portal checks. + CanPort80 bool `json:",omitempty"` } // DotInvalid is a fake DNS TLD used in tests for an invalid hostname. diff --git a/tailcfg/tailcfg_clone.go b/tailcfg/tailcfg_clone.go index 5326c495c..3f54d96d7 100644 --- a/tailcfg/tailcfg_clone.go +++ b/tailcfg/tailcfg_clone.go @@ -353,6 +353,7 @@ var _DERPNodeCloneNeedsRegeneration = DERPNode(struct { DERPPort int InsecureForTests bool STUNTestIP string + CanPort80 bool }{}) // Clone makes a deep copy of SSHRule. diff --git a/tailcfg/tailcfg_view.go b/tailcfg/tailcfg_view.go index b32ccc365..3771881f6 100644 --- a/tailcfg/tailcfg_view.go +++ b/tailcfg/tailcfg_view.go @@ -802,6 +802,7 @@ func (v DERPNodeView) STUNOnly() bool { return v.ж.STUNOnly } func (v DERPNodeView) DERPPort() int { return v.ж.DERPPort } func (v DERPNodeView) InsecureForTests() bool { return v.ж.InsecureForTests } func (v DERPNodeView) STUNTestIP() string { return v.ж.STUNTestIP } +func (v DERPNodeView) CanPort80() bool { return v.ж.CanPort80 } // A compilation failure here means this code must be regenerated, with the command at the top of this file. var _DERPNodeViewNeedsRegeneration = DERPNode(struct { @@ -816,6 +817,7 @@ var _DERPNodeViewNeedsRegeneration = DERPNode(struct { DERPPort int InsecureForTests bool STUNTestIP string + CanPort80 bool }{}) // View returns a readonly view of SSHRule.