Skip to content

Commit 1d60693

Browse files
committed
android: stop watching legacy netmap notifications
Follow up to tailscale/tailscale#19607, which introduced the constant-time node add/remove path and temporarily kept Android on legacy Notify.NetMap emission. Move the Android app notification watcher to InitialStatus plus peer-change notifications, and opt both Android watchers out of runtime NetMap delivery. Updates tailscale/tailscale#12542 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
1 parent 3551106 commit 1d60693

9 files changed

Lines changed: 309 additions & 75 deletions

File tree

android/src/main/java/com/tailscale/ipn/ui/model/Ipn.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ class Ipn {
4242
val OutgoingFiles: List<OutgoingFile>? = null,
4343
val State: Int? = null,
4444
var Prefs: Prefs? = null,
45-
var NetMap: Netmap.NetworkMap? = null,
45+
var SelfChange: Tailcfg.Node? = null,
46+
var InitialStatus: IpnState.Status? = null,
47+
var PeersChanged: List<Tailcfg.Node>? = null,
48+
var PeersRemoved: List<NodeID>? = null,
49+
var UserProfiles: Map<String, Tailcfg.UserProfile>? = null,
4650
var Engine: EngineStatus? = null,
4751
var BrowseToURL: String? = null,
4852
var BackendLogId: String? = null,

android/src/main/java/com/tailscale/ipn/ui/model/IpnState.kt

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,34 @@ class IpnState {
1717

1818
@Serializable
1919
data class PeerStatus(
20-
val ID: StableNodeID,
21-
val HostName: String,
22-
val DNSName: String,
20+
val ID: StableNodeID = "",
21+
val NodeID: NodeID = 0,
22+
val PublicKey: KeyNodePublic = "",
23+
val HostName: String = "",
24+
val DNSName: String = "",
25+
val OS: String = "",
26+
val UserID: UserID = 0,
27+
val AltSharerUserID: UserID = 0,
2328
val TailscaleIPs: List<Addr>? = null,
29+
val AllowedIPs: List<Prefix>? = null,
2430
val Tags: List<String>? = null,
2531
val PrimaryRoutes: List<String>? = null,
2632
val Addrs: List<String>? = null,
2733
val CurAddr: String? = null,
2834
val Relay: String? = null,
2935
val PeerRelay: String? = null,
30-
val Online: Boolean,
31-
val ExitNode: Boolean,
32-
val ExitNodeOption: Boolean,
33-
val Active: Boolean,
36+
val LastSeen: String? = null,
37+
val Online: Boolean = false,
38+
val ExitNode: Boolean = false,
39+
val ExitNodeOption: Boolean = false,
40+
val Active: Boolean = false,
3441
val PeerAPIURL: List<String>? = null,
3542
val Capabilities: List<String>? = null,
43+
val CapMap: Map<String, kotlinx.serialization.json.JsonElement?>? = null,
3644
val SSH_HostKeys: List<String>? = null,
3745
val ShareeNode: Boolean? = null,
3846
val Expired: Boolean? = null,
47+
val KeyExpiry: String? = null,
3948
val Location: Tailcfg.Location? = null,
4049
) {
4150
fun computedName(status: Status): String {
@@ -54,24 +63,24 @@ class IpnState {
5463

5564
@Serializable
5665
data class ExitNodeStatus(
57-
val ID: StableNodeID,
58-
val Online: Boolean,
66+
val ID: StableNodeID = "",
67+
val Online: Boolean = false,
5968
val TailscaleIPs: List<Prefix>? = null,
6069
)
6170

6271
@Serializable
6372
data class TailnetStatus(
64-
val Name: String,
65-
val MagicDNSSuffix: String,
66-
val MagicDNSEnabled: Boolean,
73+
val Name: String = "",
74+
val MagicDNSSuffix: String = "",
75+
val MagicDNSEnabled: Boolean = false,
6776
)
6877

6978
@Serializable
7079
data class Status(
71-
val Version: String,
72-
val TUN: Boolean,
73-
val BackendState: String,
74-
val AuthURL: String,
80+
val Version: String = "",
81+
val TUN: Boolean = false,
82+
val BackendState: String = "",
83+
val AuthURL: String = "",
7584
val TailscaleIPs: List<Addr>? = null,
7685
val Self: PeerStatus? = null,
7786
val ExitNodeStatus: ExitNodeStatus? = null,

android/src/main/java/com/tailscale/ipn/ui/model/TailCfg.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class Tailcfg {
3232

3333
@Serializable
3434
data class UserProfile(
35-
val ID: Long,
36-
val DisplayName: String,
37-
val LoginName: String,
35+
val ID: Long = 0,
36+
val DisplayName: String = "",
37+
val LoginName: String = "",
3838
val ProfilePicURL: String? = null,
3939
) {
4040
fun isTaggedDevice(): Boolean {
@@ -68,23 +68,23 @@ class Tailcfg {
6868

6969
@Serializable
7070
data class Node(
71-
var ID: NodeID,
72-
var StableID: StableNodeID,
73-
var Name: String,
74-
var User: UserID,
71+
var ID: NodeID = 0,
72+
var StableID: StableNodeID = "",
73+
var Name: String = "",
74+
var User: UserID = 0,
7575
var Sharer: UserID? = null,
76-
var Key: KeyNodePublic,
76+
var Key: KeyNodePublic = "",
7777
var KeyExpiry: String? = null,
7878
var Addresses: List<Prefix>? = null,
7979
var AllowedIPs: List<Prefix>? = null,
8080
var Endpoints: List<String>? = null,
81-
var Hostinfo: Hostinfo,
81+
var Hostinfo: Hostinfo = Hostinfo(),
8282
var LastSeen: Time? = null,
8383
var Online: Boolean? = null,
8484
var Capabilities: List<String>? = null,
8585
var CapMap: Map<String, JsonElement?>? = null,
86-
var ComputedName: String?,
87-
var ComputedNameWithHost: String?
86+
var ComputedName: String? = null,
87+
var ComputedNameWithHost: String? = null
8888
) {
8989
val isAdmin: Boolean
9090
get() =

0 commit comments

Comments
 (0)