kirz_flutter_tunnelkit
A new Flutter plugin project.
Getting Started
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
- 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