Latest 0.0.1
Homepage https://github.com/barbayrak/VPNManager
License MIT
Platforms ios 11.0
Frameworks NetworkExtension, Foundation
Authors

VPNManager cocoapodsCarthage compatible Swift 5.0

How to get started

CocoaPods

platform :ios, '11.0'

# You need to set target when you use CocoaPods 1.0.0 or later.
target 'SampleTarget' do
  use_frameworks!
  pod 'VPNManager'
end

Methods

//Import Framework
import VPNManager

//Create your VPN Manager variable
let vpn = VPNManager.shared
vpn.delegate = self 

//Create your VPN Account and configurations
let vpnAccount = VPNAccount(id: "UNIQUE ID", type: VPNProtocolType.IKEv2, title: "TITLE SEEN IN SETTINGS", server: "IP HERE", account: "bd2147240ab2471d", groupName: "Group Name Of Your VPN", remoteId: "Remote IP Address(Same most of the time)", alwaysOn: true)

//Set your account password and secret
vpnAccount.passwordRef = "YourVPNPassword".data(using: .utf8)
//If you are using IPSec you can use this in order to set secret
vpnAccount.secretRef = "YourVPNSecret".data(using: .utf8)
//Note : If you want to secure you secrets and passwords for your VPN you can use some Keychain wrapper 

//Save and connect your 
vpn.saveAndConnect(account : vpnAccount)

//Only Save account then connect
vpn.save(account : vpnAccount)
vpn.connect()

//Disconnect
vpn.disconnect()

//Remove saved Account
vpn.removeProfile()

//Config On Demand (Connect only on request is made)
vpn.configOnDemand()

Delegate Methods

VPNManagerDelegate Methods:

public func VpnManagerConnectionFailed(error : VPNCollectionErrorType , localizedDescription : String)

This called when connection failed with error type and description

public func VpnManagerConnected()

This method called when connection established successfully

public func VpnManagerDisconnected()

This method called when disconnect action made successfully

public func VpnManagerProfileSaved()

This method called when you save your VPN account

public func VpnManagerProfileDeleted()

This method called when you delete your VPN account

Requirements

  • Swift 5
  • iOS 11.0 or above.

License

MIT

Latest podspec

{
    "name": "VPNManager",
    "version": "0.0.1",
    "summary": "VPN Connection manager for IKEV2 and IPSec protocols",
    "description": "VPN Manager for IKEV2 and IPSec protocols . You can connect your VPN servers using this manager for iOS",
    "homepage": "https://github.com/barbayrak/VPNManager",
    "license": "MIT",
    "authors": {
        "Kaan Baris BAYRAK": "[email protected]"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/barbayrak/VPNManager.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "VPNManager",
        "VPNManager/**/*.{h,m,c,swift}"
    ],
    "public_header_files": "VPNManager/**/*.h",
    "frameworks": [
        "NetworkExtension",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This