NEVPNManager rules automatically disconnecting

370 views Asked by At

I have a NEVPNProtocolIKEv2 connection. How to configure rule so that after 10 minutes the connection is disconnected?

        let providerManagerIKEv2 = NEVPNProtocolIKEv2()
        providerManagerIKEv2.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
        providerManagerIKEv2.serverAddress = "ip address"
        providerManagerIKEv2.disconnectOnSleep = false
        providerManagerIKEv2.deadPeerDetectionRate = NEVPNIKEv2DeadPeerDetectionRate.medium
        providerManagerIKEv2.sharedSecretReference = KeychainWrapper.standard.dataRef(forKey: "sharedSecretIKEv2")
        providerManagerIKEv2.disableMOBIKE = false
        providerManagerIKEv2.disableRedirect = false
        providerManagerIKEv2.enableRevocationCheck = false
        providerManagerIKEv2.enablePFS = false
        providerManagerIKEv2.useExtendedAuthentication = true
        providerManagerIKEv2.useConfigurationAttributeInternalIPSubnet = false

        providerManagerIKEv2.remoteIdentifier = DataManager.sharedInstance.configServer.remoteID
        providerManagerIKEv2.localIdentifier = DataManager.sharedInstance.configServer.localID
        providerManagerIKEv2.username = DataManager.sharedInstance.configServer.username
        providerManagerIKEv2.passwordReference = KeychainWrapper.standard.dataRef(forKey: "password")

        self.loadProfileIKEv2 { _ in
            self.manager.protocolConfiguration = providerManagerIKEv2
            self.manager.onDemandRules = [NEOnDemandRuleConnect()]
            self.manager.isOnDemandEnabled = false
            self.manager.isEnabled = true
            self.manager.localizedDescription = "VPN"
}
0

There are 0 answers