Fix route status indicator for dynamic (DNS) routes (#117)

* fix(iOS): correct route status indicator for dynamic (DNS) routes

The status indicator stayed yellow forever for dynamic routes because
the previous logic searched for the literal "invalid Prefix" sentinel
inside domain strings, which never matched.

Match the Android client's logic: a dynamic route is "connected" (green)
when any resolved IP for one of its domains appears in a Connected peer's
route list. Compare addresses with the CIDR mask stripped, since peer
routes carry /32 suffixes while resolved IPs do not.

Switch the bridge DTO from a comma-joined ResolvedIPs string to a
structured [String] list (mirrors Android's ResolvedIPs collection in
client/android/network_domains.go), so consumers no longer depend on
the Go-side string formatting.

Bumps netbird-core submodule.

* debug(iOS): log status indicator decisions in RouteCard

Adds verbose NSLog output explaining why each route card resolves to
gray, yellow, or green. To be reverted once the dynamic-route status
indicator regression is diagnosed.

* debug(iOS): route status indicator decisions to AppLogger

Replace NSLog with AppLogger.shared.log so traces land in the shared
swift-log.log file. Deduplicate per-route decisions so SwiftUI
re-renders don't flood the rotating log.

* fix(iOS): drop "invalid Prefix" sentinel, align with Android route logic

The bridge now exposes Domains.SafeString() as the Network value for
dynamic (DNS) routes, matching the Android client. That string also
appears in peer.routes (it's what dynamic.Route.String() returns), so
a single peer.routes.contains(route.network) check works for both
static and dynamic routes — no sentinel branching needed.

Replace "invalid Prefix" checks with route.domains presence checks in
the status indicator, route display text, and tooltip detail view, on
both iOS and tvOS.

Bumps netbird-core submodule.

* chore(iOS): remove RouteCard status-indicator debug logging

Diagnosis is complete; the verbose AppLogger output and dedup cache
in statusIndicatorColor are no longer needed.

* chore(iOS): point netbird-core submodule at merged upstream commit

The bridge change (structured ResolvedIPs collection + dynamic-route
Network exposure) has landed on the netbird-core main branch as
f23aaa9ae. Replace the local feature-branch SHA with the merged one.
This commit is contained in:
Zoltan Papp
2026-05-07 13:19:56 +02:00
committed by GitHub
parent b5ca6c4e55
commit 3f67c8b397
6 changed files with 36 additions and 20 deletions
@@ -98,20 +98,30 @@ struct RouteCard: View {
}
private var statusIndicatorColor: Color {
if route.selected && peerViewModel.peerInfo.contains(where: { info in
info.connStatus == "Connected" && (info.routes.contains(route.network ?? "") || route.domains?.contains(where: { $0.domain.contains(route.network ?? "") }) == true)
}) {
guard route.selected else { return Color.gray.opacity(0.5) }
let connectedPeerRoutes = peerViewModel.peerInfo
.filter { $0.connStatus == "Connected" }
.flatMap { $0.routes }
if let network = route.network, connectedPeerRoutes.contains(network) {
return Color.green
}
return route.selected ? Color.yellow : Color.gray.opacity(0.5)
let resolvedIPs = (route.domains ?? []).flatMap { $0.resolvedIPs }
if resolvedIPs.contains(where: connectedPeerRoutes.contains) {
return Color.green
}
return Color.yellow
}
private var routeDisplayText: String {
if route.network == "invalid Prefix" {
if let domains = route.domains, domains.count > 2 {
if let domains = route.domains, !domains.isEmpty {
if domains.count > 2 {
return "\(domains.count) Domains"
}
return route.domains?.map { $0.domain }.joined(separator: ", ") ?? ""
return domains.map { $0.domain }.joined(separator: ", ")
}
return route.network ?? "Unknown"
}
@@ -159,11 +169,9 @@ struct RouteTooltipView: View {
@ViewBuilder
func detailInfo() -> some View {
Group {
if route.network == "invalid Prefix" {
if let domains = route.domains {
ForEach(domains, id: \.self) { domain in
detailRow(label: domain.domain, value: domain.resolvedips ?? "")
}
if let domains = route.domains, !domains.isEmpty {
ForEach(domains, id: \.self) { domain in
detailRow(label: domain.domain, value: domain.resolvedIPs.joined(separator: ", "))
}
} else {
detailRow(label: "Network", value: route.network ?? "")
@@ -177,11 +177,11 @@ struct TVNetworkCard: View {
}
private var routeDisplayText: String {
if route.network == "invalid Prefix" {
if let domains = route.domains, domains.count > 2 {
if let domains = route.domains, !domains.isEmpty {
if domains.count > 2 {
return "\(domains.count) Domains"
}
return route.domains?.map { $0.domain }.joined(separator: ", ") ?? ""
return domains.map { $0.domain }.joined(separator: ", ")
}
return route.network ?? ""
}
@@ -613,7 +613,11 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
let domains = (0..<(route.domains?.size() ?? 0)).compactMap { domainIndex -> DomainDetails? in
guard let domain = route.domains?.get(domainIndex) else { return nil }
return DomainDetails(domain: domain.domain, resolvedips: domain.resolvedIPs)
let resolvedIPsRef = domain.getResolvedIPs()
let resolvedIPs: [String] = (0..<(resolvedIPsRef?.size() ?? 0)).map { ipIndex in
resolvedIPsRef?.get(ipIndex) ?? ""
}.filter { !$0.isEmpty }
return DomainDetails(domain: domain.domain, resolvedIPs: resolvedIPs)
}
return RoutesSelectionInfo(
+2 -2
View File
@@ -59,12 +59,12 @@ extension RoutesSelectionInfo: Equatable {
struct DomainDetails: Codable, Hashable {
let domain: String
let resolvedips: String?
let resolvedIPs: [String]
}
extension DomainDetails: Equatable {
static func == (lhs: DomainDetails, rhs: DomainDetails) -> Bool {
return lhs.domain == rhs.domain &&
lhs.resolvedips == rhs.resolvedips
lhs.resolvedIPs == rhs.resolvedIPs
}
}
@@ -474,7 +474,11 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
let domains = (0..<(route.domains?.size() ?? 0)).compactMap { domainIndex -> DomainDetails? in
guard let domain = route.domains?.get(domainIndex) else { return nil }
return DomainDetails(domain: domain.domain, resolvedips: domain.resolvedIPs)
let resolvedIPsRef = domain.getResolvedIPs()
let resolvedIPs: [String] = (0..<(resolvedIPsRef?.size() ?? 0)).map { ipIndex in
resolvedIPsRef?.get(ipIndex) ?? ""
}.filter { !$0.isEmpty }
return DomainDetails(domain: domain.domain, resolvedIPs: resolvedIPs)
}
return RoutesSelectionInfo(