net/netcheck: change DERP HTTPS latency measurement to TCP connect time

HTTPS and ICMP latency are fallbacks when STUN doesn't work. The lowest
value wins. When ICMP doesn't work you just get HTTPS. HTTPS latency was
way more variable than it needed to be as we were measuring "server
processing time" (inclusive of TLS, HTTPS) instead of just TCP connect
time.

We don't need to perform an HTTPS request, we really just need a TCP
ping, but aiming for a simpler change to start.

Updates tailscale/corp#22114

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited 2024-08-08 15:38:18 -07:00
parent f23932bd98
commit ac0f1cfcf4
No known key found for this signature in database
GPG Key ID: 33DF352F65991EB8

View File

@ -1108,9 +1108,9 @@ func (c *Client) measureHTTPSLatency(ctx context.Context, reg *tailcfg.DERPRegio
} }
result.End(c.timeNow()) result.End(c.timeNow())
// TODO: decide best timing heuristic here. // TODO(jwhited): consider simplified TCP RTT. We don't need HTTPS or TLS
// Maybe the server should return the tcpinfo_rtt? // involvement above.
return result.ServerProcessing, ip, nil return result.TCPConnection, ip, nil
} }
func (c *Client) measureAllICMPLatency(ctx context.Context, rs *reportState, need []*tailcfg.DERPRegion) error { func (c *Client) measureAllICMPLatency(ctx context.Context, rs *reportState, need []*tailcfg.DERPRegion) error {