Skip to content

Commit 88a5d3c

Browse files
authored
android: modify mullvad exit node detection logic (#656)
updates tailscale/corp#29045 We ran into an issue where the current detection logic was not sufficient to filter out mullvad nodes. This modifies the logic so we scan both the Name and ComputedName for the mullvad domain and also treat all nodes with location info as mullvad nodes. While all of these conditions *should* be true for any mullvad node, in practice it's possible that they aren't so we or them together for some redundancy and define a mullvad exit node to be any node where any of these conditions is true. Signed-off-by: Jonathan Nobels <[email protected]>
1 parent 38f2662 commit 88a5d3c

File tree

1 file changed

+7
-2
lines changed
  • android/src/main/java/com/tailscale/ipn/ui/model

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import com.tailscale.ipn.ui.util.DisplayAddress
1515
import com.tailscale.ipn.ui.util.TimeUtil
1616
import com.tailscale.ipn.ui.util.flag
1717
import com.tailscale.ipn.ui.viewModel.PeerSettingInfo
18-
import java.util.Date
1918
import kotlinx.serialization.Serializable
2019
import kotlinx.serialization.json.JsonElement
20+
import java.util.Date
2121

2222
class Tailcfg {
2323
@Serializable
@@ -107,8 +107,13 @@ class Tailcfg {
107107
val isExitNode: Boolean =
108108
(AllowedIPs?.contains("0.0.0.0/0") ?: false) && (AllowedIPs?.contains("::/0") ?: false)
109109

110+
// mullvad nodes are exit nodes with a mullvad.ts.net domain *or* Location Info.
111+
// These checks are intentionally redundant to avoid false negatives.
110112
val isMullvadNode: Boolean
111-
get() = Name.endsWith(".mullvad.ts.net.")
113+
get() =
114+
Name.endsWith(".mullvad.ts.net") ||
115+
ComputedName?.endsWith(".mullvad.ts.net") == true ||
116+
Hostinfo.Location != null
112117

113118
val displayName: String
114119
get() = ComputedName ?: Name

0 commit comments

Comments
 (0)