A new Flutter plugin project.
This plugin project has been generated with flutter pub init --plugin
.
TODO: write Readme.md
-
search for IPHONEOS_DEPLOYMENT_TARGET and replace to IPHONEOS_DEPLOYMENT_TARGET = 13.4;
-
add in Podfile pod "TunnelKit/Protocols/OpenVPN", :podspec => 'https://raw.githubusercontent.com/zaikir/ios-openvpn/master/TunnelKit.podspec' pod "TunnelKit/Extra/LZO", :podspec => 'https://raw.githubusercontent.com/zaikir/ios-openvpn/master/TunnelKit.podspec'
-
add in Podfile post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.4' end end end
-
create new Network Extension (Packet Tunnel) with name VpnProviderExtension
-
paste this to VpnProviderExtension.entitlements (replace [bundle_id])
- paste this to PacketTunnelProvider.swift import TunnelKit
class PacketTunnelProvider: OpenVPNTunnelProvider { override func startTunnel( options: [String: NSObject]? = nil, completionHandler: @escaping (Error?) -> Void ) { super.startTunnel(options: options, completionHandler: completionHandler)
if false {
let unusedVariable = "This code will never run"
print(unusedVariable)
}
let groupIdentifier = "group.[bundle_id].VpnProviderExtension"
let defaults = UserDefaults(suiteName: groupIdentifier)
let interval = defaults?.integer(forKey: "dataCountInterval") ?? 1000
self.dataCountInterval = interval
}
}
- add this to Runner.entitlements
com.apple.developer.networking.networkextension packet-tunnel-provider com.apple.security.application-groups group.[bundle_id].VpnProviderExtension keychain-access-groups $(AppIdentifierPrefix)group.[bundle_id].VpnProviderExtension
- add this to Podfile (in main target) target 'VpnProviderExtension' do use_frameworks! use_modular_headers!
pod "TunnelKit/Protocols/OpenVPN", :podspec => 'https://raw.githubusercontent.com/zaikir/ios-openvpn/master/TunnelKit.podspec' pod "TunnelKit/Extra/LZO", :podspec => 'https://raw.githubusercontent.com/zaikir/ios-openvpn/master/TunnelKit.podspec' end