refactor: centralize gateway parsing

This commit is contained in:
Peter Steinberger
2025-12-20 19:53:08 +01:00
parent 50e817f193
commit d159602928
4 changed files with 58 additions and 45 deletions

View File

@@ -89,11 +89,10 @@ struct GatewayDiscoveryInlineList: View {
let host = self.sanitizedTailnetHost(gateway.tailnetDns) ?? gateway.lanHost
guard let host else { return nil }
let user = NSUserName()
var target = "\(user)@\(host)"
if gateway.sshPort != 22 {
target += ":\(gateway.sshPort)"
}
return target
return GatewayDiscoveryModel.buildSSHTarget(
user: user,
host: host,
port: gateway.sshPort)
}
private func sanitizedTailnetHost(_ host: String?) -> String? {