You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/cmd/derper
Brad Fitzpatrick 3d7fb6c21d derp/derphttp: fix race in mesh watcher
The derphttp client automatically reconnects upon failure.

RunWatchConnectionLoop called derphttp.Client.WatchConnectionChanges
once, but that wrapper method called the underlying
derp.Client.WatchConnectionChanges exactly once on derphttp.Client's
currently active connection. If there's a failure, we need to re-subscribe
upon all reconnections.

This removes the derphttp.Client.WatchConnectionChanges method, which
was basically impossible to use correctly, and changes it to be a
boolean field on derphttp.Client alongside MeshKey and IsProber. Then
it moves the call to the underlying derp.Client.WatchConnectionChanges
to derphttp's client connection code, so it's resubscribed on any
reconnect.

Some paranoia is then added to make sure people hold the API right,
not calling derphttp.Client.RunWatchConnectionLoop on an
already-started Client without having set the bool to true. (But still
auto-setting it to true if that's the first method that's been called
on that derphttp.Client, as is commonly the case, and prevents
existing code from breaking)

Fixes tailscale/corp#9916
Supercedes tailscale/tailscale#9719

Co-authored-by: Val <valerie@tailscale.com>
Co-authored-by: Irbe Krumina <irbe@tailscale.com>
Co-authored-by: Anton Tolchanov <anton@tailscale.com>
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
8 months ago
..
bootstrap_dns.go cmd/derper: count bootstrap dns unique lookups. 10 months ago
bootstrap_dns_test.go cmd/derper: count bootstrap dns unique lookups. 10 months ago
cert.go cmd/derper: disable http2 1 year ago
depaware.txt ipn, safesocket: use Windows token in LocalAPI 8 months ago
derper.go cmd/derper,tsweb: consistently add HTTP security headers (#8579) 12 months ago
derper_test.go net/packet: split off checksum munging into different pkg 9 months ago
mesh.go derp/derphttp: fix race in mesh watcher 8 months ago
websocket.go net/wsconn: accept a remote addr string and plumb it through 10 months ago