diff --git a/NucleicRemote/NucleicRemote/Models/HostConnection.swift b/NucleicRemote/NucleicRemote/Models/HostConnection.swift index 654ab5f..8436ad5 100644 --- a/NucleicRemote/NucleicRemote/Models/HostConnection.swift +++ b/NucleicRemote/NucleicRemote/Models/HostConnection.swift @@ -201,6 +201,18 @@ final class HostConnection { relayMembershipToken: nil, relayURL: nil) } + /// Whether the dialable endpoints of a gossiped record differ from the one on file — the + /// signal that a known Mac must be re-dialed (its LAN port, tailnet IP, or relay room moved). + /// Ignores relay *credentials* (token/URL), which `mergePairedHost` preserves and which don't + /// change where the Mac is reached. + private static func dialableAddressChanged(from existing: PairedHost, to incoming: PairedHost) -> Bool { + existing.lanHost != incoming.lanHost + || existing.lanPort != incoming.lanPort + || existing.tailnetHost != incoming.tailnetHost + || existing.tailnetPort != incoming.tailnetPort + || existing.relayRoomID != incoming.relayRoomID + } + /// Split a "host:port" hint (last-colon split so a bracketed IPv6 host survives). private static func splitHostPort(_ hint: String?) -> (String?, UInt16?) { guard let hint, let colon = hint.lastIndex(of: ":"),