Restore DNS "Domain" setting (#260)

This commit is contained in:
Davide De Rosa 2023-03-17 22:16:04 +01:00 committed by GitHub
parent f06f097f27
commit c85f3d894e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 6 deletions

View File

@ -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) - 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) - 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] - 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 ### Changed

View File

@ -51,7 +51,7 @@
"repositoryURL": "https://github.com/passepartoutvpn/tunnelkit", "repositoryURL": "https://github.com/passepartoutvpn/tunnelkit",
"state": { "state": {
"branch": null, "branch": null,
"revision": "47281cafc99dcfd0bdf60d41b3357cdbb33875fa", "revision": "e0c0cc137fbceea6970d226445afa79a7903881c",
"version": null "version": null
} }
}, },

View File

@ -143,7 +143,8 @@ extension NetworkSettingsView {
} }
if !settings.isAutomaticDNS && settings.dns.configurationType != .disabled { if !settings.isAutomaticDNS && settings.dns.configurationType != .disabled {
dnsManualServers 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 { Section {
EditableTextList( EditableTextList(
elements: $settings.dns.dnsSearchDomains ?? [], elements: $settings.dns.dnsSearchDomains ?? [],

View File

@ -24,7 +24,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on. // Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"), // .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", 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(name: "TunnelKit", path: "../../tunnelkit"),
.package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"), .package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"),
.package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0") .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0")

View File

@ -54,6 +54,8 @@ public protocol DNSSettingsProviding {
var dnsServers: [String]? { get } var dnsServers: [String]? { get }
var dnsDomain: String? { get }
var dnsSearchDomains: [String]? { get } var dnsSearchDomains: [String]? { get }
var dnsHTTPSURL: URL? { get } var dnsHTTPSURL: URL? { get }
@ -107,6 +109,8 @@ extension Network {
public var dnsServers: [String]? public var dnsServers: [String]?
public var dnsDomain: String?
public var dnsSearchDomains: [String]? public var dnsSearchDomains: [String]?
public var dnsHTTPSURL: URL? public var dnsHTTPSURL: URL?

View File

@ -53,7 +53,12 @@ extension Profile.OpenVPNSettings: DNSSettingsProviding {
configuration.dnsServers configuration.dnsServers
} }
// dhcp-option DOMAIN/DOMAIN-SEARCH // dhcp-option DOMAIN
public var dnsDomain: String? {
configuration.dnsDomain
}
// dhcp-option DOMAIN-SEARCH
public var dnsSearchDomains: [String]? { public var dnsSearchDomains: [String]? {
configuration.searchDomains configuration.searchDomains
} }

View File

@ -37,6 +37,10 @@ extension Profile.WireGuardSettings: DNSSettingsProviding {
configuration.dnsServers configuration.dnsServers
} }
public var dnsDomain: String? {
nil
}
public var dnsSearchDomains: [String]? { public var dnsSearchDomains: [String]? {
configuration.dnsSearchDomains configuration.dnsSearchDomains
} }

View File

@ -123,6 +123,7 @@ extension OpenVPN.ConfigurationBuilder {
if isDNSEnabled { if isDNSEnabled {
dnsServers = settings.dnsServers?.filter { !$0.isEmpty } dnsServers = settings.dnsServers?.filter { !$0.isEmpty }
dnsDomain = settings.dnsDomain
searchDomains = settings.dnsSearchDomains searchDomains = settings.dnsSearchDomains
} }
} }

View File

@ -95,7 +95,14 @@ extension WireGuard.ConfigurationBuilder {
switch settings.configurationType { switch settings.configurationType {
case .plain: case .plain:
dnsServers = settings.dnsServers ?? [] 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: case .disabled:
dnsServers = [] dnsServers = []