net/interfaces: add IsExpensive and up state to State

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-04-09 19:10:55 -07:00
committed by Brad Fitzpatrick
parent a55c4217db
commit c0697e1feb
3 changed files with 35 additions and 2 deletions

View File

@ -27,5 +27,23 @@ func TestIsTailscaleIP(t *testing.T) {
t.Errorf("F(%q) = %v; want %v", tt.ip, got, tt.want)
}
}
}
func TestGetState(t *testing.T) {
st, err := GetState()
if err != nil {
t.Fatal(err)
}
t.Logf("Got: %#v", st)
st2, err := GetState()
if err != nil {
t.Fatal(err)
}
if !st.Equal(st2) {
// let's assume nobody was changing the system network interfaces between
// the two GetState calls.
t.Fatal("two States back-to-back were not equal")
}
}