File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ public struct InterfaceConfiguration {
11
11
public var mtu : UInt16 ?
12
12
public var dns = [ DNSServer] ( )
13
13
public var dnsSearch = [ String] ( )
14
+ public var dnsHTTPSURL : URL ?
15
+ public var dnsTLSServerName : String ?
14
16
15
17
public init ( privateKey: PrivateKey ) {
16
18
self . privateKey = privateKey
@@ -27,6 +29,8 @@ extension InterfaceConfiguration: Equatable {
27
29
lhs. listenPort == rhs. listenPort &&
28
30
lhs. mtu == rhs. mtu &&
29
31
lhs. dns == rhs. dns &&
30
- lhs. dnsSearch == rhs. dnsSearch
32
+ lhs. dnsSearch == rhs. dnsSearch &&
33
+ lhs. dnsHTTPSURL == rhs. dnsHTTPSURL &&
34
+ lhs. dnsTLSServerName == rhs. dnsTLSServerName
31
35
}
32
36
}
Original file line number Diff line number Diff line change @@ -85,11 +85,25 @@ class PacketTunnelSettingsGenerator {
85
85
86
86
if !tunnelConfiguration. interface. dnsSearch. isEmpty || !tunnelConfiguration. interface. dns. isEmpty {
87
87
let dnsServerStrings = tunnelConfiguration. interface. dns. map { $0. stringRepresentation }
88
- let dnsSettings = NEDNSSettings ( servers: dnsServerStrings)
88
+
89
+ let dnsSettings : NEDNSSettings
90
+ if let dnsHTTPSURL = tunnelConfiguration. interface. dnsHTTPSURL {
91
+ let dohSettings = NEDNSOverHTTPSSettings ( servers: dnsServerStrings)
92
+ dohSettings. serverURL = dnsHTTPSURL
93
+ dnsSettings = dohSettings
94
+ } else if let dnsTLSServerName = tunnelConfiguration. interface. dnsTLSServerName {
95
+ let dotSettings = NEDNSOverTLSSettings ( servers: dnsServerStrings)
96
+ dotSettings. serverName = dnsTLSServerName
97
+ dnsSettings = dotSettings
98
+ } else {
99
+ dnsSettings = NEDNSSettings ( servers: dnsServerStrings)
100
+ }
101
+
89
102
dnsSettings. searchDomains = tunnelConfiguration. interface. dnsSearch
90
103
if !tunnelConfiguration. interface. dns. isEmpty {
91
104
dnsSettings. matchDomains = [ " " ] // All DNS queries must first go through the tunnel's DNS
92
105
}
106
+
93
107
networkSettings. dnsSettings = dnsSettings
94
108
}
95
109
You can’t perform that action at this time.
0 commit comments