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 {
1111 public var mtu : UInt16 ?
1212 public var dns = [ DNSServer] ( )
1313 public var dnsSearch = [ String] ( )
14+ public var dnsHTTPSURL : URL ?
15+ public var dnsTLSServerName : String ?
1416
1517 public init ( privateKey: PrivateKey ) {
1618 self . privateKey = privateKey
@@ -27,6 +29,8 @@ extension InterfaceConfiguration: Equatable {
2729 lhs. listenPort == rhs. listenPort &&
2830 lhs. mtu == rhs. mtu &&
2931 lhs. dns == rhs. dns &&
30- lhs. dnsSearch == rhs. dnsSearch
32+ lhs. dnsSearch == rhs. dnsSearch &&
33+ lhs. dnsHTTPSURL == rhs. dnsHTTPSURL &&
34+ lhs. dnsTLSServerName == rhs. dnsTLSServerName
3135 }
3236}
Original file line number Diff line number Diff line change @@ -85,11 +85,25 @@ class PacketTunnelSettingsGenerator {
8585
8686 if !tunnelConfiguration. interface. dnsSearch. isEmpty || !tunnelConfiguration. interface. dns. isEmpty {
8787 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+
89102 dnsSettings. searchDomains = tunnelConfiguration. interface. dnsSearch
90103 if !tunnelConfiguration. interface. dns. isEmpty {
91104 dnsSettings. matchDomains = [ " " ] // All DNS queries must first go through the tunnel's DNS
92105 }
106+
93107 networkSettings. dnsSettings = dnsSettings
94108 }
95109
You can’t perform that action at this time.
0 commit comments