mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-20 11:58:39 +00:00
net/netcheck: add a Now field to the netcheck Report
Some checks failed
CI / privileged (push) Has been cancelled
CI / vm (push) Has been cancelled
CI / race-build (push) Has been cancelled
CI / go_generate (push) Has been cancelled
checklocks / checklocks (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
Dockerfile build / deploy (push) Has been cancelled
CI / go_mod_tidy (push) Has been cancelled
CI / race-root-integration (1/4) (push) Has been cancelled
CI / race-root-integration (2/4) (push) Has been cancelled
CI / race-root-integration (3/4) (push) Has been cancelled
CI / race-root-integration (4/4) (push) Has been cancelled
CI / test (-coverprofile=/tmp/coverage.out, amd64) (push) Has been cancelled
CI / windows (push) Has been cancelled
CI / test (-race, amd64, 1/3) (push) Has been cancelled
CI / test (-race, amd64, 2/3) (push) Has been cancelled
CI / test (-race, amd64, 3/3) (push) Has been cancelled
CI / test (386) (push) Has been cancelled
CI / cross (386, linux) (push) Has been cancelled
CI / cross (amd64, windows) (push) Has been cancelled
CI / cross (arm, 5, linux) (push) Has been cancelled
CI / cross (arm, 7, linux) (push) Has been cancelled
CI / cross (arm64, darwin) (push) Has been cancelled
CI / cross (arm64, linux) (push) Has been cancelled
CI / cross (arm64, windows) (push) Has been cancelled
CI / cross (loong64, linux) (push) Has been cancelled
CI / ios (push) Has been cancelled
CI / crossmin (amd64, plan9) (push) Has been cancelled
CI / licenses (push) Has been cancelled
CI / crossmin (ppc64, aix) (push) Has been cancelled
CI / android (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / tailscale_go (push) Has been cancelled
CI / fuzz (push) Has been cancelled
CI / depaware (push) Has been cancelled
CI / staticcheck (386, windows) (push) Has been cancelled
CI / staticcheck (amd64, darwin) (push) Has been cancelled
CI / staticcheck (amd64, linux) (push) Has been cancelled
CI / staticcheck (amd64, windows) (push) Has been cancelled
CI / notify_slack (push) Has been cancelled
CI / check_mergeability (push) Has been cancelled
CI / cross (amd64, darwin) (push) Has been cancelled
CI / cross (amd64, freebsd) (push) Has been cancelled
CI / cross (amd64, openbsd) (push) Has been cancelled
Some checks failed
CI / privileged (push) Has been cancelled
CI / vm (push) Has been cancelled
CI / race-build (push) Has been cancelled
CI / go_generate (push) Has been cancelled
checklocks / checklocks (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
Dockerfile build / deploy (push) Has been cancelled
CI / go_mod_tidy (push) Has been cancelled
CI / race-root-integration (1/4) (push) Has been cancelled
CI / race-root-integration (2/4) (push) Has been cancelled
CI / race-root-integration (3/4) (push) Has been cancelled
CI / race-root-integration (4/4) (push) Has been cancelled
CI / test (-coverprofile=/tmp/coverage.out, amd64) (push) Has been cancelled
CI / windows (push) Has been cancelled
CI / test (-race, amd64, 1/3) (push) Has been cancelled
CI / test (-race, amd64, 2/3) (push) Has been cancelled
CI / test (-race, amd64, 3/3) (push) Has been cancelled
CI / test (386) (push) Has been cancelled
CI / cross (386, linux) (push) Has been cancelled
CI / cross (amd64, windows) (push) Has been cancelled
CI / cross (arm, 5, linux) (push) Has been cancelled
CI / cross (arm, 7, linux) (push) Has been cancelled
CI / cross (arm64, darwin) (push) Has been cancelled
CI / cross (arm64, linux) (push) Has been cancelled
CI / cross (arm64, windows) (push) Has been cancelled
CI / cross (loong64, linux) (push) Has been cancelled
CI / ios (push) Has been cancelled
CI / crossmin (amd64, plan9) (push) Has been cancelled
CI / licenses (push) Has been cancelled
CI / crossmin (ppc64, aix) (push) Has been cancelled
CI / android (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / tailscale_go (push) Has been cancelled
CI / fuzz (push) Has been cancelled
CI / depaware (push) Has been cancelled
CI / staticcheck (386, windows) (push) Has been cancelled
CI / staticcheck (amd64, darwin) (push) Has been cancelled
CI / staticcheck (amd64, linux) (push) Has been cancelled
CI / staticcheck (amd64, windows) (push) Has been cancelled
CI / notify_slack (push) Has been cancelled
CI / check_mergeability (push) Has been cancelled
CI / cross (amd64, darwin) (push) Has been cancelled
CI / cross (amd64, freebsd) (push) Has been cancelled
CI / cross (amd64, openbsd) (push) Has been cancelled
This allows us to print the time that a netcheck was run, which is useful in debugging. Updates #10972 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Id48d30d4eb6d5208efb2b1526a71d83fe7f9320b
This commit is contained in:
parent
ae5bc88ebe
commit
b2665d9b89
@ -136,6 +136,7 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("\nReport:\n")
|
printf("\nReport:\n")
|
||||||
|
printf("\t* Time: %v\n", report.Now.Format(time.RFC3339Nano))
|
||||||
printf("\t* UDP: %v\n", report.UDP)
|
printf("\t* UDP: %v\n", report.UDP)
|
||||||
if report.GlobalV4.IsValid() {
|
if report.GlobalV4.IsValid() {
|
||||||
printf("\t* IPv4: yes, %s\n", report.GlobalV4)
|
printf("\t* IPv4: yes, %s\n", report.GlobalV4)
|
||||||
|
@ -85,13 +85,14 @@ const (
|
|||||||
|
|
||||||
// Report contains the result of a single netcheck.
|
// Report contains the result of a single netcheck.
|
||||||
type Report struct {
|
type Report struct {
|
||||||
UDP bool // a UDP STUN round trip completed
|
Now time.Time // the time the report was run
|
||||||
IPv6 bool // an IPv6 STUN round trip completed
|
UDP bool // a UDP STUN round trip completed
|
||||||
IPv4 bool // an IPv4 STUN round trip completed
|
IPv6 bool // an IPv6 STUN round trip completed
|
||||||
IPv6CanSend bool // an IPv6 packet was able to be sent
|
IPv4 bool // an IPv4 STUN round trip completed
|
||||||
IPv4CanSend bool // an IPv4 packet was able to be sent
|
IPv6CanSend bool // an IPv6 packet was able to be sent
|
||||||
OSHasIPv6 bool // could bind a socket to ::1
|
IPv4CanSend bool // an IPv4 packet was able to be sent
|
||||||
ICMPv4 bool // an ICMPv4 round trip completed
|
OSHasIPv6 bool // could bind a socket to ::1
|
||||||
|
ICMPv4 bool // an ICMPv4 round trip completed
|
||||||
|
|
||||||
// MappingVariesByDestIP is whether STUN results depend which
|
// MappingVariesByDestIP is whether STUN results depend which
|
||||||
// STUN server you're talking to (on IPv4).
|
// STUN server you're talking to (on IPv4).
|
||||||
@ -1297,6 +1298,7 @@ func (c *Client) addReportHistoryAndSetPreferredDERP(rs *reportState, r *Report,
|
|||||||
c.prev = map[time.Time]*Report{}
|
c.prev = map[time.Time]*Report{}
|
||||||
}
|
}
|
||||||
now := c.timeNow()
|
now := c.timeNow()
|
||||||
|
r.Now = now.UTC()
|
||||||
c.prev[now] = r
|
c.prev[now] = r
|
||||||
c.last = r
|
c.last = r
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ func newTestClient(t testing.TB) *Client {
|
|||||||
c := &Client{
|
c := &Client{
|
||||||
NetMon: netmon.NewStatic(),
|
NetMon: netmon.NewStatic(),
|
||||||
Logf: t.Logf,
|
Logf: t.Logf,
|
||||||
|
TimeNow: func() time.Time {
|
||||||
|
return time.Unix(1729624521, 0)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
@ -52,6 +55,9 @@ func TestBasic(t *testing.T) {
|
|||||||
if !r.UDP {
|
if !r.UDP {
|
||||||
t.Error("want UDP")
|
t.Error("want UDP")
|
||||||
}
|
}
|
||||||
|
if r.Now.IsZero() {
|
||||||
|
t.Error("Now is zero")
|
||||||
|
}
|
||||||
if len(r.RegionLatency) != 1 {
|
if len(r.RegionLatency) != 1 {
|
||||||
t.Errorf("expected 1 key in DERPLatency; got %+v", r.RegionLatency)
|
t.Errorf("expected 1 key in DERPLatency; got %+v", r.RegionLatency)
|
||||||
}
|
}
|
||||||
@ -130,6 +136,14 @@ func TestWorksWhenUDPBlocked(t *testing.T) {
|
|||||||
|
|
||||||
want := newReport()
|
want := newReport()
|
||||||
|
|
||||||
|
// The Now field can't be compared with reflect.DeepEqual; check using
|
||||||
|
// the Equal method and then overwrite it so that the comparison below
|
||||||
|
// succeeds.
|
||||||
|
if !r.Now.Equal(c.TimeNow()) {
|
||||||
|
t.Errorf("Now = %v; want %v", r.Now, c.TimeNow())
|
||||||
|
}
|
||||||
|
want.Now = r.Now
|
||||||
|
|
||||||
// The IPv4CanSend flag gets set differently across platforms.
|
// The IPv4CanSend flag gets set differently across platforms.
|
||||||
// On Windows this test detects false, while on Linux detects true.
|
// On Windows this test detects false, while on Linux detects true.
|
||||||
// That's not relevant to this test, so just accept what we're
|
// That's not relevant to this test, so just accept what we're
|
||||||
|
Loading…
x
Reference in New Issue
Block a user