diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3133f1..5bd5315c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Prompt for password interactively. [#3](https://github.com/passepartoutvpn/passepartout-apple/issues/3) - Ukranian translations (Dmitry Chirkin). [#243](https://github.com/passepartoutvpn/passepartout-apple/pull/243) +- Restore DNS "Domain" setting. [#260](https://github.com/passepartoutvpn/passepartout-apple/pull/260) - OpenVPN: Full implementation of Tunnelblick XOR patch (tmthecoder). [#245](https://github.com/passepartoutvpn/passepartout-apple/pull/245), [tunnelkit#255][https://github.com/passepartoutvpn/tunnelkit/pull/255] ### Changed diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ba29503e..a9f98fea 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -51,7 +51,7 @@ "repositoryURL": "https://github.com/passepartoutvpn/tunnelkit", "state": { "branch": null, - "revision": "47281cafc99dcfd0bdf60d41b3357cdbb33875fa", + "revision": "e0c0cc137fbceea6970d226445afa79a7903881c", "version": null } }, diff --git a/Passepartout/App/Views/NetworkSettingsView.swift b/Passepartout/App/Views/NetworkSettingsView.swift index e95b47c6..7c5ce1d3 100644 --- a/Passepartout/App/Views/NetworkSettingsView.swift +++ b/Passepartout/App/Views/NetworkSettingsView.swift @@ -143,7 +143,8 @@ extension NetworkSettingsView { } if !settings.isAutomaticDNS && settings.dns.configurationType != .disabled { dnsManualServers - dnsManualDomains + dnsManualDomainRow + dnsManualSearchDomains } } @@ -178,7 +179,12 @@ extension NetworkSettingsView { } } - private var dnsManualDomains: some View { + private var dnsManualDomainRow: some View { + TextField(L10n.Global.Strings.domain, text: $settings.dns.dnsDomain ?? "") + .themeValidDomainName(settings.dns.dnsDomain) + } + + private var dnsManualSearchDomains: some View { Section { EditableTextList( elements: $settings.dns.dnsSearchDomains ?? [], diff --git a/PassepartoutLibrary/Package.swift b/PassepartoutLibrary/Package.swift index da1227ae..6711cc55 100644 --- a/PassepartoutLibrary/Package.swift +++ b/PassepartoutLibrary/Package.swift @@ -24,7 +24,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), // .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", from: "5.0.0"), - .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("47281cafc99dcfd0bdf60d41b3357cdbb33875fa")), + .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("e0c0cc137fbceea6970d226445afa79a7903881c")), // .package(name: "TunnelKit", path: "../../tunnelkit"), .package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"), .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0") diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Network.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Network.swift index 1dfb9e66..0874860c 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Network.swift @@ -54,6 +54,8 @@ public protocol DNSSettingsProviding { var dnsServers: [String]? { get } + var dnsDomain: String? { get } + var dnsSearchDomains: [String]? { get } var dnsHTTPSURL: URL? { get } @@ -107,6 +109,8 @@ extension Network { public var dnsServers: [String]? + public var dnsDomain: String? + public var dnsSearchDomains: [String]? public var dnsHTTPSURL: URL? diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift index 97b01658..cb447c34 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift @@ -53,7 +53,12 @@ extension Profile.OpenVPNSettings: DNSSettingsProviding { configuration.dnsServers } - // dhcp-option DOMAIN/DOMAIN-SEARCH + // dhcp-option DOMAIN + public var dnsDomain: String? { + configuration.dnsDomain + } + + // dhcp-option DOMAIN-SEARCH public var dnsSearchDomains: [String]? { configuration.searchDomains } diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift index 9025584d..ac716b2a 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift @@ -37,6 +37,10 @@ extension Profile.WireGuardSettings: DNSSettingsProviding { configuration.dnsServers } + public var dnsDomain: String? { + nil + } + public var dnsSearchDomains: [String]? { configuration.dnsSearchDomains } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OpenVPNSettings+VPNConfiguration.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OpenVPNSettings+VPNConfiguration.swift index 5d2598c9..d289d38c 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OpenVPNSettings+VPNConfiguration.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OpenVPNSettings+VPNConfiguration.swift @@ -123,6 +123,7 @@ extension OpenVPN.ConfigurationBuilder { if isDNSEnabled { dnsServers = settings.dnsServers?.filter { !$0.isEmpty } + dnsDomain = settings.dnsDomain searchDomains = settings.dnsSearchDomains } } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/WireGuardSettings+VPNConfiguration.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/WireGuardSettings+VPNConfiguration.swift index 2b129918..459297b2 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/WireGuardSettings+VPNConfiguration.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/WireGuardSettings+VPNConfiguration.swift @@ -95,7 +95,14 @@ extension WireGuard.ConfigurationBuilder { switch settings.configurationType { case .plain: dnsServers = settings.dnsServers ?? [] - dnsSearchDomains = settings.dnsSearchDomains?.filter { !$0.isEmpty } ?? [] + var allDomains: [String] = [] + if let domain = settings.dnsDomain { + allDomains.insert(domain, at: 0) + } + if let searchDomains = settings.dnsSearchDomains { + allDomains.append(contentsOf: searchDomains) + } + dnsSearchDomains = allDomains.filter { !$0.isEmpty } case .disabled: dnsServers = []