VPNGN In-App SDK for iOS
Installation​
Download the VPNGN SDK for iOS from the Downloads page
Open Xcode
Create two Network Extensions for two protocols:
a. Go to File -> New -> Target
b. Select Network Extension
c. Use product name SocketTunnel for ShadowSocks and WGTunnel for Wireguard
d. Put the content of the corresponding folder into the newly created extension source code folder
e. Add Network Extensions capability and select Packet Filter checkbox
For SocketTunnel extension ensure that:
a. Framework and libraries section include: libVPNSDKSocksTunnel.xcframework and Tun2socks.xcframework
Add Swift package: https://git.zx2c4.com/wireguard-apple
For WGTunnel ensure that:
a. Framework and libraries section include: WGTunnel-1.xcframework, WGTunnel-2.xcframework, WireGuardKit
Use the following snippet in order to create VPNGN view controller:
let vc = VPNSDK.VPNGNViewController()
vc.setConfig(domain: "", shortToken: "", loginScreen: "user") {error, doHide in
//Process logout
doHide() // Hide view
}Parameters:
domain - Your subdomain
shortToken - The end-user's short token
loginScreen - The Login screen to show in case that short token is empty:
"user" for username/password login screen
"token" for token based login screen
Traffic Counter (optional)​
Add the IO Counter:
vc.setIOCounter { bytesIn, bytesOut in
// your code here
}