├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── top
│ │ │ │ └── wherewego
│ │ │ │ └── vnt_app
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── vpn
│ │ │ │ ├── DeviceConfig.java
│ │ │ │ ├── IpUtils.java
│ │ │ │ └── MyVpnService.java
│ │ ├── jniLibs
│ │ │ ├── arm64-v8a
│ │ │ │ └── librust_lib_vnt_app.so
│ │ │ ├── armeabi-v7a
│ │ │ │ └── librust_lib_vnt_app.so
│ │ │ ├── x86
│ │ │ │ └── librust_lib_vnt_app.so
│ │ │ └── x86_64
│ │ │ │ └── librust_lib_vnt_app.so
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-ldpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── app_icon.ico
├── app_icon.png
└── log4rs.yaml
├── flutter_rust_bridge.yaml
├── integration_test
└── simple_test.dart
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── icon-1024.png
│ │ │ ├── icon-20@2x.png
│ │ │ ├── icon-20@3x.png
│ │ │ ├── icon-29@2x.png
│ │ │ ├── icon-29@3x.png
│ │ │ ├── icon-38@2x.png
│ │ │ ├── icon-38@3x.png
│ │ │ ├── icon-40@2x.png
│ │ │ ├── icon-40@3x.png
│ │ │ ├── icon-60@2x.png
│ │ │ ├── icon-60@3x.png
│ │ │ ├── icon-64@2x.png
│ │ │ ├── icon-64@3x.png
│ │ │ ├── icon-68@2x.png
│ │ │ ├── icon-76@2x.png
│ │ │ └── icon-83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
└── RunnerTests
│ └── RunnerTests.swift
├── lib
├── about_page.dart
├── connect_log.dart
├── connected_page.dart
├── custom_app_bar.dart
├── data_persistence.dart
├── main.dart
├── network_config.dart
├── network_config_input_page.dart
├── settings_page.dart
├── src
│ └── rust
│ │ ├── api
│ │ └── vnt_api.dart
│ │ ├── frb_generated.dart
│ │ ├── frb_generated.io.dart
│ │ └── frb_generated.web.dart
├── utils
│ └── ip_utils.dart
├── vnt
│ └── vnt_manager.dart
└── widgets
│ ├── color_changing_button.dart
│ ├── custom_tooltip_text_field.dart
│ ├── dual_bar_chart.dart
│ └── legend_widget.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── icon-128.png
│ │ │ ├── icon-128@2x.png
│ │ │ ├── icon-16.png
│ │ │ ├── icon-16@2x.png
│ │ │ ├── icon-256.png
│ │ │ ├── icon-256@2x.png
│ │ │ ├── icon-32.png
│ │ │ ├── icon-32@2x.png
│ │ │ ├── icon-512.png
│ │ │ └── icon-512@2x.png
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── RunnerTests
│ └── RunnerTests.swift
├── pubspec.lock
├── pubspec.yaml
├── rust
├── .cargo
│ └── config
├── .gitignore
├── Cargo.lock
├── Cargo.toml
└── src
│ ├── api
│ ├── mod.rs
│ └── vnt_api.rs
│ ├── frb_generated.io.rs
│ ├── frb_generated.rs
│ ├── frb_generated.web.rs
│ └── lib.rs
├── rust_builder
├── .gitignore
├── README.md
├── android
│ ├── .gitignore
│ ├── build.gradle
│ ├── settings.gradle
│ └── src
│ │ └── main
│ │ └── AndroidManifest.xml
├── cargokit
│ ├── .gitignore
│ ├── LICENSE
│ ├── README
│ ├── build_pod.sh
│ ├── build_tool
│ │ ├── README.md
│ │ ├── analysis_options.yaml
│ │ ├── bin
│ │ │ └── build_tool.dart
│ │ ├── lib
│ │ │ ├── build_tool.dart
│ │ │ └── src
│ │ │ │ ├── android_environment.dart
│ │ │ │ ├── artifacts_provider.dart
│ │ │ │ ├── build_cmake.dart
│ │ │ │ ├── build_gradle.dart
│ │ │ │ ├── build_pod.dart
│ │ │ │ ├── build_tool.dart
│ │ │ │ ├── builder.dart
│ │ │ │ ├── cargo.dart
│ │ │ │ ├── crate_hash.dart
│ │ │ │ ├── environment.dart
│ │ │ │ ├── logging.dart
│ │ │ │ ├── options.dart
│ │ │ │ ├── precompile_binaries.dart
│ │ │ │ ├── rustup.dart
│ │ │ │ ├── target.dart
│ │ │ │ ├── util.dart
│ │ │ │ └── verify_binaries.dart
│ │ ├── pubspec.lock
│ │ └── pubspec.yaml
│ ├── cmake
│ │ ├── cargokit.cmake
│ │ └── resolve_symlinks.ps1
│ ├── gradle
│ │ └── plugin.gradle
│ ├── run_build_tool.cmd
│ └── run_build_tool.sh
├── ios
│ ├── Classes
│ │ └── dummy_file.c
│ └── rust_lib_vnt_app.podspec
├── linux
│ └── CMakeLists.txt
├── macos
│ ├── Classes
│ │ └── dummy_file.c
│ └── rust_lib_vnt_app.podspec
├── pubspec.yaml
└── windows
│ ├── .gitignore
│ └── CMakeLists.txt
├── test_driver
└── integration_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── dlls
├── amd64
│ └── wintun.dll
├── arm
│ └── wintun.dll
├── arm64
│ └── wintun.dll
└── x86
│ └── wintun.dll
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Symbolication related
35 | app.*.symbols
36 |
37 | # Obfuscation related
38 | app.*.map.json
39 |
40 | # Android Studio will place build artifacts here
41 | /android/app/debug
42 | /android/app/profile
43 | /android/app/release
44 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
17 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
18 | - platform: android
19 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
20 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
21 | - platform: ios
22 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
23 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
24 | - platform: linux
25 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
26 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
27 | - platform: macos
28 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
29 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
30 | - platform: web
31 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
32 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
33 | - platform: windows
34 | create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
35 | base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VNT GUI
2 |
3 | VNT GUI
4 |
5 | ## Build
6 |
7 | ### Install
8 |
9 | After [Flutter](https://docs.flutter.dev/get-started/install) and [Rust](https://www.rust-lang.org/tools/install) are installed, install `flutter_rust_bridge`
10 |
11 | ### Run
12 | ```
13 | flutter run
14 | ```
15 |
16 |
17 | ## Special
18 |
19 | Thanks to ChatGPT for helping with a lot of the work on this project.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26 |
27 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5 | id "dev.flutter.flutter-gradle-plugin"
6 | }
7 |
8 | def localProperties = new Properties()
9 | def localPropertiesFile = rootProject.file("local.properties")
10 | if (localPropertiesFile.exists()) {
11 | localPropertiesFile.withReader("UTF-8") { reader ->
12 | localProperties.load(reader)
13 | }
14 | }
15 |
16 | def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
17 | if (flutterVersionCode == null) {
18 | flutterVersionCode = "1"
19 | }
20 |
21 | def flutterVersionName = localProperties.getProperty("flutter.versionName")
22 | if (flutterVersionName == null) {
23 | flutterVersionName = "1.0"
24 | }
25 |
26 | android {
27 | namespace = "top.wherewego.vnt_app"
28 | compileSdk = flutter.compileSdkVersion
29 | ndkVersion = flutter.ndkVersion
30 |
31 | compileOptions {
32 | sourceCompatibility = JavaVersion.VERSION_1_8
33 | targetCompatibility = JavaVersion.VERSION_1_8
34 | }
35 |
36 | defaultConfig {
37 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
38 | applicationId = "top.wherewego.vnt_app"
39 | // You can update the following values to match your application needs.
40 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
41 | minSdk = flutter.minSdkVersion
42 | targetSdk = flutter.targetSdkVersion
43 | versionCode = flutterVersionCode.toInteger()
44 | versionName = flutterVersionName
45 | ndk {
46 | abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
47 | }
48 | versionName "1.2.11"
49 | }
50 |
51 | buildTypes {
52 | release {
53 | // TODO: Add your own signing config for the release build.
54 | // Signing with the debug keys for now, so `flutter run --release` works.
55 | signingConfig = signingConfigs.debug
56 | }
57 | }
58 | sourceSets {
59 | main {
60 | jniLibs.srcDirs = ['src/main/jniLibs']
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source = "../.."
67 | }
68 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 |
14 |
15 |
16 |
17 |
20 |
29 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
46 |
47 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/android/app/src/main/java/top/wherewego/vnt_app/MainActivity.java:
--------------------------------------------------------------------------------
1 | package top.wherewego.vnt_app;
2 |
3 | import android.content.Intent;
4 | import android.net.VpnService;
5 | import android.os.Bundle;
6 |
7 | import androidx.annotation.NonNull;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | import io.flutter.embedding.android.FlutterActivity;
14 | import io.flutter.embedding.engine.FlutterEngine;
15 | import io.flutter.plugin.common.MethodChannel;
16 | import top.wherewego.vnt_app.vpn.DeviceConfig;
17 | import top.wherewego.vnt_app.vpn.IpUtils;
18 | import top.wherewego.vnt_app.vpn.MyVpnService;
19 |
20 | public class MainActivity extends FlutterActivity {
21 | private static final String CHANNEL = "top.wherewego.vnt/vpn";
22 | private static final int VPN_REQUEST_CODE = 1;
23 | private static final String TAG = "MainActivity";
24 | public static MethodChannel channel;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | }
30 |
31 |
32 | @Override
33 | public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
34 | super.configureFlutterEngine(flutterEngine);
35 | channel = new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL);
36 | channel.setMethodCallHandler((call, result) -> {
37 | if (call.method.equals("startVpn")) {
38 | try {
39 | Map arguments = call.arguments();
40 | DeviceConfig config = parseDeviceConfig(arguments);
41 | startVpnService(config, result);
42 | } catch (Exception e) {
43 | result.error("VPN_ERROR", "Invalid DeviceConfig", e);
44 | }
45 | } else if (call.method.equals("stopVpn")) {
46 | try {
47 | MyVpnService.stopVpn();
48 | } catch (Exception e) {
49 | result.error("VPN_ERROR", "stopVpn", e);
50 | }
51 | } else {
52 | result.notImplemented();
53 | }
54 | }
55 | );
56 |
57 | }
58 |
59 | private DeviceConfig parseDeviceConfig(Map arguments) {
60 | String virtualIp = (String) arguments.get("virtualIp");
61 | String virtualNetmask = (String) arguments.get("virtualNetmask");
62 | String virtualGateway = (String) arguments.get("virtualGateway");
63 | Integer mtu = (Integer) arguments.get("mtu");
64 |
65 | List