netcheck, stunner: reduce log spam

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/115/head
Brad Fitzpatrick 5 years ago
parent 19b54d0ae7
commit f3c0ea23d9

@ -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)

@ -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

@ -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 {

Loading…
Cancel
Save