mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-23 17:18:42 +00:00
wgengine/magicsock: add debug envknob for injecting an endpoint
For testing. Lee wants to play with 'AWS Global Accelerator Custom Routing with Amazon Elastic Kubernetes Service'. If this works well enough, we can promote it. Updates #12578 Change-Id: I5018347ed46c15c9709910717d27305d0aedf8f4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
d2fef01206
commit
42dac7c5c2
@@ -6,6 +6,10 @@
|
||||
package magicsock
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/netip"
|
||||
"sync"
|
||||
|
||||
"tailscale.com/envknob"
|
||||
)
|
||||
|
||||
@@ -68,3 +72,18 @@ var (
|
||||
// checked every time at runtime, because tests set this after program
|
||||
// startup.
|
||||
func inTest() bool { return envknob.Bool("IN_TS_TEST") }
|
||||
|
||||
// pretendpoint returns TS_DEBUG_PRETENDPOINT as an AddrPort, if set.
|
||||
// See https://github.com/tailscale/tailscale/issues/12578 and
|
||||
// https://github.com/tailscale/tailscale/pull/12735.
|
||||
var pretendpoint = sync.OnceValue(func() (ap netip.AddrPort) {
|
||||
s := envknob.String("TS_DEBUG_PRETENDPOINT")
|
||||
if s == "" {
|
||||
return
|
||||
}
|
||||
ap, err := netip.ParseAddrPort(s)
|
||||
if err != nil {
|
||||
log.Printf("ignoring invalid TS_DEBUG_PRETENDPOINT %q: %v", s, err)
|
||||
}
|
||||
return ap
|
||||
})
|
||||
|
Reference in New Issue
Block a user