net/netcheck: apply some polish suggested from #12161

Apply some post-submit code review suggestions.

Updates #12161
Updates tailscale/corp#19106

Signed-off-by: James Tucker <james@tailscale.com>
pull/12241/head
James Tucker 1 month ago committed by James Tucker
parent 9a64c06a20
commit 87ee559b6f

@ -108,11 +108,11 @@ type Report struct {
RegionV4Latency map[int]time.Duration // keyed by DERP Region ID
RegionV6Latency map[int]time.Duration // keyed by DERP Region ID
GlobalV4Counters map[netip.AddrPort]int // keyed by IP:port, number of times observed
GlobalV6Counters map[netip.AddrPort]int // keyed by [IP]:port, number of times observed
GlobalV4Counters map[netip.AddrPort]int // number of times the endpoint was observed
GlobalV6Counters map[netip.AddrPort]int // number of times the endpoint was observed
GlobalV4 netip.AddrPort // ip:port of global IPv4
GlobalV6 netip.AddrPort // [ip]:port of global IPv6
GlobalV4 netip.AddrPort
GlobalV6 netip.AddrPort
// CaptivePortal is set when we think there's a captive portal that is
// intercepting HTTP traffic.
@ -125,8 +125,7 @@ type Report struct {
// netcheck, which includes the best latency endpoint first, followed by any
// other endpoints that were observed repeatedly. It excludes singular endpoints
// that are likely only the result of a hard NAT.
func (r *Report) GetGlobalAddrs() ([]netip.AddrPort, []netip.AddrPort) {
var v4, v6 []netip.AddrPort
func (r *Report) GetGlobalAddrs() (v4, v6 []netip.AddrPort) {
// Always add the best latency entries first.
if r.GlobalV4.IsValid() {
v4 = append(v4, r.GlobalV4)

Loading…
Cancel
Save