From 87ee559b6f00cc553679e44a2d42988d1ffcea44 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Fri, 17 May 2024 10:30:46 -0700 Subject: [PATCH] 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 --- net/netcheck/netcheck.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index 6f8e08eff..40f6adcbe 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -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)