0

I use NEVPNManager to creat Personal VPN (IKEV2 & IPSec). It works well. But when I use NEProxySettings add white list or proxyAutoConfigurationJavaScript code, it doesn't work. What I want to do is specify that part of the APP doesn't use the VPN proxy, such as, my own App, after connecting to the VPN, network requests can become very slow.

Here is my code:

NEVPNProtocolIKEv2 *vpnProtocollIKEv2 = [[NEVPNProtocolIKEv2 alloc] init];
NEProxySettings *proxySettings = [[NEProxySettings alloc] init];
NEProxyServer *httpsServer = [[NEProxyServer alloc] initWithAddress:ip port:port];
proxySettings.HTTPSServer = httpsServer;
NEProxyServer *httpServer = [[NEProxyServer alloc] initWithAddress:ip port:port];
proxySettings.HTTPServer = httpServer;
proxySettings.autoProxyConfigurationEnabled = NO;
proxySettings.excludeSimpleHostnames = YES;
proxySettings.HTTPEnabled = YES;
proxySettings.HTTPSEnabled = YES;
proxySettings.exceptionList = @[@“***.xxxx.***”]; // domain name
vpnProtocollIKEv2.proxySettings = proxySettings;

There is a question here, is the proxy server necessary, if so, then how to set up the proxy server? I tried to set up a local server with GCDWebServer, but the test found that it didn't work either. In addition, VPN can be started directly in the system Settings, so there is no need to start the APP every time, so the local server seems to be meaningless.

I've also tried adding JS code:

NEProxySettings *set = [[NEProxySettings alloc] init];
set.autoProxyConfigurationEnabled = YES;
//set.proxyAutoConfigurationURL = [NSURL URLWithString:@"https://zxkw.oss-cn-hangzhou.aliyuncs.com/vpn-app/KHTProxyAutoConfiguration.pac"];
set.proxyAutoConfigurationJavaScript = @"function FindProxyForURL(url, host) { return \"DIRECT\";}";

What should I do?

Young
  • 1
  • 1

0 Answers0