Skip to content

NEProxySettings #8

Description

@Young1006

您好,请教个问题,我在使用NEVPNManager开发个人VPN,连接都是正常的。我想用NEProxySettings配置某些域名绕开代理,比如VPN APP的服务器,否则打开VPN的时候,APP内接口响应太慢了。但是代理配置好像不起作用,VPN APP请求接口还是走了代理。代码如下:
`NEVPNProtocolIKEv2 *vpnProtocollIKEv2 = [[NEVPNProtocolIKEv2 alloc] init];

NEProxySettings *proxySettings = [[NEProxySettings alloc] init];

NEProxyServer *httpsServer = [[NEProxyServer alloc] initWithAddress:"xxx.xxx.xx.xxx" port: 65535];

proxySettings.HTTPSServer = httpsServer;

NEProxyServer *httpServer = [[NEProxyServer alloc] initWithAddress:"xxx.xxx.xx.xxx" port:65535];

proxySettings.HTTPServer = httpServer;

proxySettings.autoProxyConfigurationEnabled = NO;

proxySettings.excludeSimpleHostnames = YES;

proxySettings.HTTPEnabled = YES;

proxySettings.HTTPSEnabled = YES;

proxySettings.exceptionList = @[@"APP服务器域名"];

vpnProtocollIKEv2.proxySettings = proxySettings;`

我这里NEProxyServer填写的是VPN服务器,这里有个疑问,NEProxyServer指定的是VPN服务器,还是需要另外搭建代理服务器?

我也尝试过使用pac文件,但是也不起作用:

`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";}";`

也尝试过使用GCDWebServer搭建本地服务器,也不起作用,不知道哪里出了问题,烦请指导一下,谢谢

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions