parent
ef9f3c6d0a
commit
904e7bae21
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Basic support for proxy settings (no PAC). [#74](https://github.com/keeshux/tunnelkit/issues/74)
|
||||
|
||||
### Changed
|
||||
|
||||
- Make `hostname` optional and pick `resolvedAddresses` if nil.
|
||||
|
|
|
@ -555,10 +555,22 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
|||
dnsSettings.searchDomains = [searchDomain]
|
||||
}
|
||||
|
||||
var proxySettings: NEProxySettings?
|
||||
if let httpsProxy = cfg.sessionConfiguration.httpsProxy ?? reply.options.httpsProxy {
|
||||
proxySettings = NEProxySettings()
|
||||
proxySettings?.httpsServer = httpsProxy.neProxy()
|
||||
proxySettings?.httpsEnabled = true
|
||||
} else if let httpProxy = cfg.sessionConfiguration.httpProxy ?? reply.options.httpProxy {
|
||||
proxySettings = NEProxySettings()
|
||||
proxySettings?.httpServer = httpProxy.neProxy()
|
||||
proxySettings?.httpEnabled = true
|
||||
}
|
||||
|
||||
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: remoteAddress)
|
||||
newSettings.ipv4Settings = ipv4Settings
|
||||
newSettings.ipv6Settings = ipv6Settings
|
||||
newSettings.dnsSettings = dnsSettings
|
||||
newSettings.proxySettings = proxySettings
|
||||
|
||||
setTunnelNetworkSettings(newSettings, completionHandler: completionHandler)
|
||||
}
|
||||
|
@ -671,3 +683,9 @@ extension TunnelKitProvider {
|
|||
return error as? ProviderError ?? .linkError
|
||||
}
|
||||
}
|
||||
|
||||
private extension Proxy {
|
||||
func neProxy() -> NEProxyServer {
|
||||
return NEProxyServer(address: address, port: Int(port))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue