Hello, Everyone,
I'm hoping someone can help me. I'm working on an interal project for my company when the people in the building use the app.
We have an Ipsec tunnel.I run vpn in my app,A vpn connection is established, other app can use the vpn traffic. Now,I hope that only some domain names can use vpn, such as only google.com,other normal.
[[NEVPNManager sharedManager] loadFromPreferencesWithCompletionHandler:^(NSError *error) {
NEProxySettings *setting = [[NEProxySettings alloc]init];
NSMutableArray *blackList = [NSMutableArray new];
[blackList addObject:@".163.com"];
[setting setExceptionList:blackList];
NEVPNProtocolIPSec *protocol = [[NEVPNProtocolIPSec alloc] init];
protocol.username =@"username";
protocol.passwordReference =@"password";
protocol.serverAddress = @"serveraddress";
protocol.useExtendedAuthentication = NO;
protocol.authenticationMethod = NEVPNIKEAuthenticationMethodSharedSecret;
NSData *psk_data = [self getKeyChain:self.mishi key:@"PSK"];
/
protocol.sharedSecretReference = psk_data;
/
protocol.useExtendedAuthentication = YES;
protocol.disconnectOnSleep = NO;
[protocol setProxySettings:setting];
NEVPNManager *manager = [NEVPNManager sharedManager];
[manager setProtocolConfiguration:protocol];
[manager setLocalizedDescription:@"testVPN"];
[manager setOnDemandEnabled:YES];
manager.enabled = YES;
[manager saveToPreferencesWithCompletionHandler:^(NSError *error2){
if(error2) {
} else {
}
}];
}];But it did not work. Please any HELP!
Thanks