diff --git a/cmd/tailscale/netcheck.go b/cmd/tailscale/netcheck.go index 5cd529f1a..0ac65e1ef 100644 --- a/cmd/tailscale/netcheck.go +++ b/cmd/tailscale/netcheck.go @@ -19,7 +19,7 @@ func runNetcheck(ctx context.Context, args []string) error { defer cancel() report, err := netcheck.GetReport(ctx, log.Printf) if err != nil { - log.Fatal(err) + log.Fatalf("netcheck: %v", err) } fmt.Printf("\nReport:\n") fmt.Printf("\t* UDP: %v\n", report.UDP) diff --git a/netcheck/netcheck.go b/netcheck/netcheck.go index 6b3f7ca14..545a6b07f 100644 --- a/netcheck/netcheck.go +++ b/netcheck/netcheck.go @@ -91,7 +91,6 @@ func GetReport(ctx context.Context, logf logger.Logf) (*Report, error) { logf("ReadFrom: unexpected addr %T", addr) continue } - logf("Packet from %v: %q", ua, buf[:n]) s.Receive(buf[:n], ua) } @@ -120,7 +119,9 @@ func GetReport(ctx context.Context, logf logger.Logf) (*Report, error) { } err = grp.Wait() - logf("stunner.Run: %v", err) + if err != nil { + return nil, err + } mu.Lock() defer mu.Unlock() // unnecessary, but feels weird without diff --git a/stunner/stunner.go b/stunner/stunner.go index ab1c6a908..6d2c0e4e4 100644 --- a/stunner/stunner.go +++ b/stunner/stunner.go @@ -112,7 +112,6 @@ func (s *Stunner) Receive(p []byte, fromAddr *net.UDPAddr) { session := s.sessions[r.server] if session != nil { host := net.JoinHostPort(net.IP(addr).String(), fmt.Sprint(port)) - s.logf("STUN server %s reports public endpoint %s after %v", r.server, host, d) s.Endpoint(r.server, host, d) session.cancel() } @@ -127,6 +126,10 @@ func (s *Stunner) resolver() *net.Resolver { // Run starts a Stunner and blocks until all servers either respond // or are tried multiple times and timeout. +// +// TODO: this always returns success now. It should return errors +// if certain servers are unavailable probably. Or if all are. +// Or some configured threshold are. func (s *Stunner) Run(ctx context.Context) error { s.sessions = map[string]*session{} for _, server := range s.Servers {