@ -60,7 +60,7 @@ func runNetcheck(ctx context.Context, args []string) error {
}
}
if strings . HasPrefix ( netcheckArgs . format , "json" ) {
if strings . HasPrefix ( netcheckArgs . format , "json" ) {
fmt . Fprintln ( os. Stderr, "# Warning: this JSON format is not yet considered a stable interface" )
fmt . Fprintln ( Stderr, "# Warning: this JSON format is not yet considered a stable interface" )
}
}
dm , err := tailscale . CurrentDERPMap ( ctx )
dm , err := tailscale . CurrentDERPMap ( ctx )
@ -112,36 +112,36 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
}
}
if j != nil {
if j != nil {
j = append ( j , '\n' )
j = append ( j , '\n' )
os. Stdout. Write ( j )
Stdout. Write ( j )
return nil
return nil
}
}
fmt . P rintf( "\nReport:\n" )
p rintf( "\nReport:\n" )
fmt . P rintf( "\t* UDP: %v\n" , report . UDP )
p rintf( "\t* UDP: %v\n" , report . UDP )
if report . GlobalV4 != "" {
if report . GlobalV4 != "" {
fmt . P rintf( "\t* IPv4: yes, %v\n" , report . GlobalV4 )
p rintf( "\t* IPv4: yes, %v\n" , report . GlobalV4 )
} else {
} else {
fmt . P rintf( "\t* IPv4: (no addr found)\n" )
p rintf( "\t* IPv4: (no addr found)\n" )
}
}
if report . GlobalV6 != "" {
if report . GlobalV6 != "" {
fmt . P rintf( "\t* IPv6: yes, %v\n" , report . GlobalV6 )
p rintf( "\t* IPv6: yes, %v\n" , report . GlobalV6 )
} else if report . IPv6 {
} else if report . IPv6 {
fmt . P rintf( "\t* IPv6: (no addr found)\n" )
p rintf( "\t* IPv6: (no addr found)\n" )
} else {
} else {
fmt . P rintf( "\t* IPv6: no\n" )
p rintf( "\t* IPv6: no\n" )
}
}
fmt . P rintf( "\t* MappingVariesByDestIP: %v\n" , report . MappingVariesByDestIP )
p rintf( "\t* MappingVariesByDestIP: %v\n" , report . MappingVariesByDestIP )
fmt . P rintf( "\t* HairPinning: %v\n" , report . HairPinning )
p rintf( "\t* HairPinning: %v\n" , report . HairPinning )
fmt . P rintf( "\t* PortMapping: %v\n" , portMapping ( report ) )
p rintf( "\t* PortMapping: %v\n" , portMapping ( report ) )
// When DERP latency checking failed,
// When DERP latency checking failed,
// magicsock will try to pick the DERP server that
// magicsock will try to pick the DERP server that
// most of your other nodes are also using
// most of your other nodes are also using
if len ( report . RegionLatency ) == 0 {
if len ( report . RegionLatency ) == 0 {
fmt . P rintf( "\t* Nearest DERP: unknown (no response to latency probes)\n" )
p rintf( "\t* Nearest DERP: unknown (no response to latency probes)\n" )
} else {
} else {
fmt . P rintf( "\t* Nearest DERP: %v\n" , dm . Regions [ report . PreferredDERP ] . RegionName )
p rintf( "\t* Nearest DERP: %v\n" , dm . Regions [ report . PreferredDERP ] . RegionName )
fmt . P rintf( "\t* DERP latency:\n" )
p rintf( "\t* DERP latency:\n" )
var rids [ ] int
var rids [ ] int
for rid := range dm . Regions {
for rid := range dm . Regions {
rids = append ( rids , rid )
rids = append ( rids , rid )
@ -168,7 +168,7 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
if netcheckArgs . verbose {
if netcheckArgs . verbose {
derpNum = fmt . Sprintf ( "derp%d, " , rid )
derpNum = fmt . Sprintf ( "derp%d, " , rid )
}
}
fmt . P rintf( "\t\t- %3s: %-7s (%s%s)\n" , r . RegionCode , latency , derpNum , r . RegionName )
p rintf( "\t\t- %3s: %-7s (%s%s)\n" , r . RegionCode , latency , derpNum , r . RegionName )
}
}
}
}
return nil
return nil