-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devices): add missing devices fields
A number of the fields on the [devices model](https://tailscale.com/api#model/device) are not present in the corresponding go struct resulting in those fields being unreachable from the client. This updates said struct to match the current spec.
- Loading branch information
Showing
3 changed files
with
146 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,27 @@ func TestClient_Devices_Get(t *testing.T) { | |
NodeKey: "nodekey:test", | ||
OS: "windows", | ||
UpdateAvailable: true, | ||
EnabledRoutes: []string{"10.0.0.0/16"}, | ||
AdvertisedRoutes: []string{"10.0.0.0/16"}, | ||
ClientConnectivity: tsclient.DeviceClientConnectivity{ | ||
Endpoints: []string{"199.9.14.201:59128", "192.68.0.21:59128"}, | ||
Latency: map[string]tsclient.DeviceClientConnectivityLocationLatency{"Dallas": {LatencyMs: 60.463043}, "New York City": {Preferred: true, LatencyMs: 31.323811}}, | ||
MappingVariesByDestIP: false, | ||
ClientSupports: tsclient.DeviceClientConnectivityClientSupports{ | ||
HairPinning: false, | ||
IPv6: true, | ||
PCP: false, | ||
PMP: false, | ||
UDP: false, | ||
UPnP: false, | ||
}, | ||
}, | ||
TailnetLockError: "test", | ||
TailnetLockKey: "test", | ||
PostureIdentity: tsclient.DevicePostureIdentity{ | ||
Disabled: false, | ||
SerialNumbers: []string{"test"}, | ||
}, | ||
} | ||
|
||
client, server := NewTestHarness(t) | ||
|
@@ -101,6 +122,27 @@ func TestClient_Devices_List(t *testing.T) { | |
NodeKey: "nodekey:test", | ||
OS: "windows", | ||
UpdateAvailable: true, | ||
EnabledRoutes: []string{"10.0.0.0/16"}, | ||
AdvertisedRoutes: []string{"10.0.0.0/16"}, | ||
ClientConnectivity: tsclient.DeviceClientConnectivity{ | ||
Endpoints: []string{"199.9.14.201:59128", "192.68.0.21:59128"}, | ||
Latency: map[string]tsclient.DeviceClientConnectivityLocationLatency{"Dallas": {LatencyMs: 60.463043}, "New York City": {Preferred: true, LatencyMs: 31.323811}}, | ||
MappingVariesByDestIP: false, | ||
ClientSupports: tsclient.DeviceClientConnectivityClientSupports{ | ||
HairPinning: false, | ||
IPv6: true, | ||
PCP: false, | ||
PMP: false, | ||
UDP: false, | ||
UPnP: false, | ||
}, | ||
}, | ||
TailnetLockError: "test", | ||
TailnetLockKey: "test", | ||
PostureIdentity: tsclient.DevicePostureIdentity{ | ||
Disabled: false, | ||
SerialNumbers: []string{"test"}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
@@ -171,12 +213,27 @@ func TestDevices_Unmarshal(t *testing.T) { | |
LastSeen: tsclient.Time{ | ||
time.Date(2022, 4, 15, 13, 25, 21, 0, time.UTC), | ||
}, | ||
MachineKey: "mkey:30dc3c061ac8b33fdc6d88a4a67b053b01b56930d78cae0cf7a164411d424c0d", | ||
Name: "foo.example.com", | ||
NodeKey: "nodekey:30dc3c061ac8b33fdc6d88a4a67b053b01b56930d78cae0cf7a164411d424c0d", | ||
OS: "linux", | ||
UpdateAvailable: false, | ||
User: "[email protected]", | ||
MachineKey: "mkey:30dc3c061ac8b33fdc6d88a4a67b053b01b56930d78cae0cf7a164411d424c0d", | ||
Name: "foo.example.com", | ||
NodeKey: "nodekey:30dc3c061ac8b33fdc6d88a4a67b053b01b56930d78cae0cf7a164411d424c0d", | ||
OS: "linux", | ||
UpdateAvailable: false, | ||
User: "[email protected]", | ||
EnabledRoutes: []string{"10.0.0.0/16", "192.168.1.0/24"}, | ||
AdvertisedRoutes: []string{"10.0.0.0/16", "192.168.1.0/24"}, | ||
ClientConnectivity: tsclient.DeviceClientConnectivity{ | ||
Endpoints: []string{"199.9.14.201:59128", "192.68.0.21:59128"}, | ||
Latency: map[string]tsclient.DeviceClientConnectivityLocationLatency{"Dallas": {LatencyMs: 60.463043}, "New York City": {Preferred: true, LatencyMs: 31.323811}}, | ||
MappingVariesByDestIP: false, | ||
ClientSupports: tsclient.DeviceClientConnectivityClientSupports{ | ||
HairPinning: false, | ||
IPv6: true, | ||
PCP: false, | ||
PMP: false, | ||
UDP: false, | ||
UPnP: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,39 @@ | |
"nodeKey": "nodekey:30dc3c061ac8b33fdc6d88a4a67b053b01b56930d78cae0cf7a164411d424c0d", | ||
"os": "linux", | ||
"updateAvailable": false, | ||
"user": "[email protected]" | ||
"user": "[email protected]", | ||
"enabledRoutes": [ | ||
"10.0.0.0/16", | ||
"192.168.1.0/24" | ||
], | ||
"advertisedRoutes": [ | ||
"10.0.0.0/16", | ||
"192.168.1.0/24" | ||
], | ||
"clientConnectivity": { | ||
"endpoints": [ | ||
"199.9.14.201:59128", | ||
"192.68.0.21:59128" | ||
], | ||
"latency": { | ||
"Dallas": { | ||
"latencyMs": 60.463043 | ||
}, | ||
"New York City": { | ||
"preferred": true, | ||
"latencyMs": 31.323811 | ||
} | ||
}, | ||
"mappingVariesByDestIP": false, | ||
"clientSupports": { | ||
"hairPinning": false, | ||
"ipv6": true, | ||
"pcp": false, | ||
"pmp": false, | ||
"udp": false, | ||
"upnp": false | ||
} | ||
} | ||
} | ||
] | ||
} |