Plugin to access VPN service for Flutter | Flutter 的 VPN 插件

Overview

Flutter VPN plugin

Pub Package Awesome Flutter

This plugin help developers to access VPN service in their flutter app.
本插件帮助开发者在自己的应用内调用 VPN 服务。

The Android part was implemented by strongswan which support ikev2 protocol.
The iOS part was implemented by NEVPNManager.

Issues and PRs are welcome!

Installation

For Android

Modify your app/build.gradle to use abiFilter since flutter doesn't apply abiFilter for target platform yet.

android {
    ...
    buildTypes {
        ...
        release {
            ...
            ndk {
                if (!project.hasProperty('target-platform')) {
                    abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
                } else {
                    def platforms = project.property('target-platform').split(',')
                    def platformMap = [
                            'android-arm'  : 'armeabi-v7a',
                            'android-arm64': 'arm64-v8a',
                            'android-x86'  : 'x86',
                            'android-x64'  : 'x86_64',
                    ]
                    abiFilters = platforms.stream().map({ e ->
                        platformMap.containsKey(e) ? platformMap[e] : e
                    }).toArray()
                }
            }
    }
}

The plugin will automatically download pre-build native libraries from here if they haven't been downloaded.

For iOS

You need to open Personal VPN and Network Extensions capabilities in Xcode: see Project->Capabilities.

VPN connection errors are handled in swift code, you need to use Xcode to see connection errors if there is any.

Comments
  • When pressing back button on the app brings to home screen and crash

    When pressing back button on the app brings to home screen and crash

    When pressing back button on the app brings to home screen and crash.

    It says:

    App keeps stopping

    Unable to destroy activity com.myapp.testvpn/com.example.testvpn MainActivity): java.lang.IllegalArgumentException: Service not registered: io.xdea.flutter_vpn.FlutterVpnPlugin$

    _serviceConnection

    bug 
    opened by aldwnesx 15
  • every time getting FlutterVpnState.unreachableError status

    every time getting FlutterVpnState.unreachableError status

    Whenever i am trying to connect to any VPN server using this plugin getting unreachableError as status and unable to connect to any VPN. I pinged those servers and checked, they are working fine.

    opened by smobiledev 8
  • App Lunch Failed after installing Release APK

    App Lunch Failed after installing Release APK

    Hi, I am facing a problem when building release apk.

    Whenever I am trying to install release apk generated by running "flutter build apk --release", It crushes before starting.

    But the apk generated from "flutter run --release" seems to work just fine.

    opened by bubundas17 7
  • Release app don't run

    Release app don't run

    Hi, I was trying out the library and it works just fine in debug mode but when I tried to build the apk it builds with an error Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. And the app crash when I tried to open the app.

    If there is fix please let me know. And thank you very much.

    opened by GlitchIO-bd 6
  • Guide on setting up the VPN server

    Guide on setting up the VPN server

    Hey guys,

    I've already setup an IKev2 strongswan vpn server, but the server needs a trusted CA cert, while the plugin can't upload a ca cert.

    any guides on how to setup the IKev2 vpn server that would work with this plugin, server that doesnt need adding a ca cert?

    opened by mfo33 5
  • vpn connection not stopped when force close app

    vpn connection not stopped when force close app

    when i close the app I mean ending the app process.. the vpn is still connected....

    how to fix this when i force close or end app process disconnect vpn?

    opened by aldwnesx 5
  • doesn't work on devices like pixel 2

    doesn't work on devices like pixel 2

    I added the ndk filters as described on read me.

    However when I build appbundle and run it on pixel 2 , it crashes on start up

    drops java.lang.UnsatisfiedLinkError coudln't find libflutter.so

    bug 
    opened by aldwnesx 5
  • Not working in iOS

    Not working in iOS

    Hello,

    Example app is not working in iOS. I used latest release version (not master branch).

    I already opened Personal VPN and Network Extensions in capabilities. Status shows "connected" but I don't see any VPN sign. And then I clicked status updated, It's show now "disconnected"

    Btw: It's working well in Android. Same server same config.

    opened by pyaehein 4
  • stop when prepare() called on android 6.1

    stop when prepare() called on android 6.1

    VM environment

    Nexus 6 API 23

    D/AndroidRuntime(15737): Shutting down VM
    E/AndroidRuntime(15737): FATAL EXCEPTION: main
    E/AndroidRuntime(15737): Process: com.example.shadowsock, PID: 15737
    E/AndroidRuntime(15737): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.example.shadowsock/com.example.shadowsock.MainActivity}: java.lang.IllegalStateException: Reply already submitted
    E/AndroidRuntime(15737): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
    E/AndroidRuntime(15737): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
    E/AndroidRuntime(15737): 	at android.app.ActivityThread.-wrap16(ActivityThread.java)
    E/AndroidRuntime(15737): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
    E/AndroidRuntime(15737): 	at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime(15737): 	at android.os.Looper.loop(Looper.java:148)
    E/AndroidRuntime(15737): 	at android.app.ActivityThread.main(ActivityThread.java:5417)
    E/AndroidRuntime(15737): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(15737): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    E/AndroidRuntime(15737): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    E/AndroidRuntime(15737): Caused by: java.lang.IllegalStateException: Reply already submitted
    E/AndroidRuntime(15737): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
    E/AndroidRuntime(15737): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:208)
    E/AndroidRuntime(15737): 	at io.xdea.fluttervpn.FlutterVpnPlugin$Companion.onPrepareResult(FlutterVpnPlugin.kt:53)
    E/AndroidRuntime(15737): 	at io.xdea.fluttervpn.FlutterVpnPlugin$onMethodCall$1.onActivityResult(FlutterVpnPlugin.kt:64)
    E/AndroidRuntime(15737): 	at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210)
    E/AndroidRuntime(15737): 	at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139)
    E/AndroidRuntime(15737): 	at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138)
    E/AndroidRuntime(15737): 	at android.app.Activity.dispatchActivityResult(Activity.java:6428)
    E/AndroidRuntime(15737): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
    E/AndroidRuntime(15737): 	... 9 more
    I/Process (15737): Sending signal. PID: 15737 SIG: 9
    Lost connection to device.
    Exited (sigterm)
    
    opened by shyandsy 4
  • error occur when build release apk

    error occur when build release apk

    PS D:\std> flutter build apk
    Initializing gradle...                                       0.9s
    Resolving dependencies...                                    4.4s
    Gradle task 'assembleRelease'...
    Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_vpn-0.0.3\android\src\main\java\org\strongswan\android\logic\NetworkManager.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    
    opened by shyandsy 3
  • ***** WARNING: FOR ALL DEVELOPERS USING THIS PACKAGE  *****

    ***** WARNING: FOR ALL DEVELOPERS USING THIS PACKAGE *****

    This package works fine in development environment and debug build, but application WILL NOT WORK after build Release so you can't run or upload application in google store, I find out this problem too late after I finished my application development, its too pain.

    Don't waste your time

    opened by realbitt 2
  • NEVPNManager object is invalid ios

    NEVPNManager object is invalid ios

    Runner[36110:3052503] [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(4, Start error: The VPN configuration associated with the NEVPNManager object is invalid., null, null)

    opened by Caqil 2
  • remoteIdentifier and serverAddress are using the same parma for iOS

    remoteIdentifier and serverAddress are using the same parma for iOS

    I check the VPNHandler.swift, and i found the remoteIdentifier and serverAddress are using the same parma, but some time they are not the same things. Could you add additional parma for remoteIdentifier? Thank you. remoteID

    opened by hanorz 0
  •  Where to find a data retrieval service to connect to a VPN via ikev2

    Where to find a data retrieval service to connect to a VPN via ikev2

    Where to find a data retrieval service to connect to a VPN via ikev2

    I have already looked at many paid services, but there is practically no ikev2 anywhere. If you know a good service where you can buy this data, I will be very grateful for the recommendation.

    opened by xande-er 1
Releases(v0.12.0)
Owner
Xdea
An geek organization focus on creativity
Xdea
File picker plugin for Flutter, compatible with both iOS & Android and desktop (go-flutter).

File Picker A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support. Currently s

Miguel Ruivo 985 Jan 5, 2023
Community WebView Plugin - Allows Flutter to communicate with a native WebView.

NOTICE We are working closely with the Flutter Team to integrate all the Community Plugin features in the Official WebView Plugin. We will try our bes

Flutter Community 1.4k Jan 7, 2023
A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.

Flutter Location Plugin This plugin for Flutter handles getting location on Android and iOS. It also provides callbacks when location is changed. Gett

Guillaume Bernos 953 Dec 22, 2022
Flutter geolocation plugin for Android and iOS.

geolocation Flutter geolocation plugin for Android API 16+ and iOS 9+. Features: Manual and automatic location permission management Current one-shot

Loup 221 Dec 27, 2022
A Flutter plugin for displaying local notifications on Android, iOS and macOS

Flutter Local Notifications plugin This repository consists hosts the following packages flutter_local_notifications: code for the cross-platform faci

Michael Bui 2.1k Dec 30, 2022
Flutter Downloader - A plugin for creating and managing download tasks. Supports iOS and Android. Maintainer: @hnvn

Flutter Downloader A plugin for creating and managing download tasks. Supports iOS and Android. This plugin is based on WorkManager in Android and NSU

Flutter Community 789 Jan 3, 2023
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.

Flutter InAppWebView Plugin A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser windo

Lorenzo Pichilli 2.3k Jan 8, 2023
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Flutter AppAvailability Plugin A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed a

Lorenzo Pichilli 89 Dec 2, 2022
Android and iOS Geolocation plugin for Flutter

Flutter Geolocator Plugin A Flutter geolocation plugin which provides easy access to platform specific location services (FusedLocationProviderClient

Baseflow 1k Jan 5, 2023
Flutter Plugin for AR (Augmented Reality) - Supports ARKit on iOS and ARCore on Android devices

ar_flutter_plugin Flutter Plugin for AR (Augmented Reality) - Supports ARKit for iOS and ARCore for Android devices. Many thanks to Oleksandr Leuschen

Lars Carius 222 Jan 4, 2023
A lightweight Flutter plugin for making payments and printing on MyPos

my_poster ?? my_poster is in beta - please provide feedback (and/or contribute) if you find issues ??️ A lightweight Flutter plugin for making payment

Antonio Mentone 3 Oct 10, 2022
Telegram stickers importing Flutter plugin for iOS and Android

TelegramStickersImport — Telegram stickers importing Flutter plugin for iOS and Android TelegramStickersImport helps your users import third-party pro

Iurii Dorofeev 20 Dec 3, 2022
Plugin to retrieve a persistent UDID across app reinstalls on iOS and Android.

flutter_udid Plugin to retrieve a persistent UDID across app reinstalls on iOS and Android. Getting Started import 'package:flutter_udid/flutter_udid.

Leon Kukuk 183 Dec 21, 2022
Flutter library for iOS Widgets Extensions. Integrate a Widget into your App 🍏📱

flutter_widgetkit Flutter Library for the iOS ?? WidgetKit framework and Widget Communication Table of Contents ?? Introduction ??‍?? Installation ??‍

Fasky 227 Dec 31, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
Get It - Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App. Maintainer: @escamoteur

❤️ Sponsor get_it This is a simple Service Locator for Dart and Flutter projects with some additional goodies highly inspired by Splat. It can be used

Flutter Community 1k Jan 1, 2023
Home-Service-App - Home Service App Built With Flutter

Home-Service-App Home Service App Sample Images

Justin Roy 2 Sep 4, 2022
Our application, MyArmyPal serves to be an all in one service for our service men.

Our application, MyArmyPal serves to be an all in one service for our service men. It seeks to provide convenience and useful features just one tap away. Its main features include an IPPT Calculator, reservist checklist, customized IPPT training plan according to the user's current fitness level and a canteen order pick up service in all army camps. We are also implementing an anytime Eliss system using computer vision for users to check on their push up form easily.

Poh Wei Pin 3 Jun 17, 2022
Vpn app concept UI designed using flutter

VPN App - Flutter UI This project is an implementation of a Design i found on dribbble.com by Umar Aji Pratama ❤️ Found this project useful? If you fo

Muhammad Adeel 11 Nov 30, 2022
A Flutter plugin for iOS and Android allowing access to the device cameras.

Camera Plugin A Flutter plugin for iOS and Android allowing access to the device cameras. Note: This plugin is still under development, and some APIs

Rebar Ahmad 1 Mar 17, 2020