How to configure NEPacketTunnelProvider to make HTTP requests or other SOCKS connections not go through the proxy?

84 Views Asked by At

I want NEPacketTunnelProvider to filter out my own HTTP or SOCKS connections. I have tried setting NEProxySettings' exceptionList or proxyAutoConfigurationJavaScript and setting autoProxyConfigurationEnabled to YES, but it doesn't seem to work. I'm not sure where I've gone wrong with the configuration.

This is part of my code.

        settings.exceptionList = @[@"www.xxxx.xxx"];//Ip address is also not working.
        settings.proxyAutoConfigurationJavaScript = [NSString stringWithFormat:@"function FindProxyForURL(url, host) { if(dnsDomainIs(host, \"www.xxxx.xxx\")) return \"DIRECT\"; return \"PROXY %@:%@\"}", proxyAddress, @(proxyPort)];
        settings.autoProxyConfigurationEnabled = YES;
0

There are 0 best solutions below