fix(mac): add tailnet discovery fallback and debug CLI

This commit is contained in:
Peter Steinberger
2026-01-10 23:39:14 +01:00
parent c731a87d07
commit 621f710d60
19 changed files with 759 additions and 50 deletions

View File

@@ -0,0 +1,26 @@
import ClawdbotKit
import Foundation
import Network
public enum BridgeEndpointID {
public static func stableID(_ endpoint: NWEndpoint) -> String {
switch endpoint {
case let .service(name, type, domain, _):
// Keep stable across encoded/decoded differences (e.g. \032 for spaces).
let normalizedName = Self.normalizeServiceNameForID(name)
return "\(type)|\(domain)|\(normalizedName)"
default:
return String(describing: endpoint)
}
}
public static func prettyDescription(_ endpoint: NWEndpoint) -> String {
BonjourEscapes.decode(String(describing: endpoint))
}
private static func normalizeServiceNameForID(_ rawName: String) -> String {
let decoded = BonjourEscapes.decode(rawName)
let normalized = decoded.split(whereSeparator: \.isWhitespace).joined(separator: " ")
return normalized.trimmingCharacters(in: .whitespacesAndNewlines)
}
}