@@ -20,6 +20,7 @@ import (
20
20
"golang.org/x/xerrors"
21
21
"gvisor.dev/gvisor/pkg/tcpip"
22
22
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
23
+ "tailscale.com/envknob"
23
24
"tailscale.com/ipn/ipnstate"
24
25
"tailscale.com/net/connstats"
25
26
"tailscale.com/net/dns"
@@ -64,6 +65,22 @@ func init() {
64
65
// Globally disable network namespacing. All networking happens in
65
66
// userspace.
66
67
netns .SetEnabled (false )
68
+ // Tailscale, by default, "trims" the set of peers down to ones that we are
69
+ // "actively" communicating with in an effort to save memory. Since
70
+ // Tailscale removed keep-alives, it seems like open but idle connections
71
+ // (SSH, port-forward, etc) can get trimmed fairly easily, causing hangs for
72
+ // a few seconds while the connection is setup again.
73
+ //
74
+ // Note that Tailscale.com's use case is very different from ours: in their
75
+ // use case, users create one persistent tailnet per device, and it allows
76
+ // connections to every other thing in Tailscale that belongs to them. The
77
+ // tailnet stays up as long as your laptop or phone is turned on.
78
+ //
79
+ // Our use case is different: for clients, it's a point-to-point connection
80
+ // to a single workspace, and lasts only as long as the connection. For
81
+ // agents, it's connections to a small number of clients (CLI or Coderd)
82
+ // that are being actively used by the end user.
83
+ envknob .Setenv ("TS_DEBUG_TRIM_WIREGUARD" , "false" )
67
84
}
68
85
69
86
type Options struct {
0 commit comments