使用NEVPNManager的IPSec VPN不会在睡眠时断开连接

我正在为macOS开发IPSec VPN解决方案。我设法通过NEVPnmanager安装了VPN配置,并且一切正常。除此之外,我的要求是在Mac进入睡眠状态时断开VPN的连接。下面是我正在使用的IPSec配置文件。

- (void)setupIPSec

{

    [self configVPNKeychain];

    NSData *passwordData = [self persistentReferenceForSavedPassword:@"username" service:kPasswordReference account:@"account" description:@"login"];

    NSData *sharedSecretData = [self persistentReferenceForSavedPassword:@"54343333" service:kSharedSecretReference account:@"account" description:@"IPSec Shared Secret"];



    // config IPSec protocol

    NEVPNProtocolIPSec *p = [[NEVPNProtocolIPSec alloc] init];
    p.username = @"username012134";
    p.serverAddress = @"ipsec.route.com";

    // get password persistent reference from keychain
    p.passwordReference = passwordData;
    p.authenticationmethod = NEVPNIKEAuthenticationmethodSharedSecret;
    p.sharedSecretReference = sharedSecretData;
    p.useExtendedAuthentication = YES;
    p.disconnectOnSleep = YES;   // This is were I am setting YES to disconnect the VPN connection when on Sleep.

    [NEVPnmanager sharedManager].enabled = YES;
    [NEVPnmanager sharedManager].protocolConfiguration = p;
    [NEVPnmanager sharedManager].localizedDescription = @"VPN";

}

任何人都可以引导我。

chenxinpao 回答:使用NEVPNManager的IPSec VPN不会在睡眠时断开连接

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3144309.html

大家都在问