How can I set the proxy settings for a connection established with Network
(and not using URLSession
) ?
As described in this answer, one can do so with URLSession
by updating the configuration:
configuration.connectionProxyDictionary = [
kCFNetworkProxiesHTTPEnable as String: 1,
kCFNetworkProxiesHTTPProxy as String: ip,
kCFNetworkProxiesHTTPPort as String: port,
"HTTPSEnable": 1,
"HTTPSProxy": ip,
"HTTPSPort": port,
]
I would like to do something similar using the Network
library.
I am currently creating my connection as:
NWConnection(host: host, port: port, using: .init())
but I don't know how to configure it to use a Proxy.