add lfs .a

add lfs .a
This commit is contained in:
Zeus
2024-07-24 10:24:29 +08:00
parent a723ebb0ff
commit 22ff62e567
24 changed files with 454 additions and 208 deletions
BIN
View File
Binary file not shown.
-73
View File
@@ -1,73 +0,0 @@
[English](./README.md) | 简体中文
# Sail
![Flutter](https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white)
![Rust](https://img.shields.io/badge/Rust-000000?style=for-the-badge&logo=rust&logoColor=white)
![Kotlin](https://img.shields.io/badge/Kotlin-0095D5?&style=for-the-badge&logo=kotlin&logoColor=white)
![Swift](https://img.shields.io/badge/Swift-FA7343?style=for-the-badge&logo=swift&logoColor=white)
![iOS](https://img.shields.io/badge/iOS-000000?style=for-the-badge&logo=ios&logoColor=white)
![Android](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white)
[![Flutter](https://github.com/sail-tunnel/sail/actions/workflows/flutter.yml/badge.svg)](https://github.com/sail-tunnel/sail/actions/workflows/flutter.yml)
使用 [Flutter](https://github.com/flutter/flutter) 为 [V2Board](https://github.com/v2board/v2board) ~~及 [SSPanel-Uim](https://github.com/Anankke/SSPanel-Uim) 构建的应用~~
现在支持iOS而非Android, 我没有Android设备😂.
重现 [Mohammad Reza Farahzad 的设计](https://dribbble.com/shots/14028358-VPN-App-Ui-Design?utm_source=Clipboard_Shot&utm_campaign=mrfarahzad&utm_content=VPN%20App%20Ui%20Design&utm_medium=Social_Share)
**如果这个项目对你有帮助,请给我一颗小星星⭐️。**
## 截图
<img src="https://user-images.githubusercontent.com/13404752/174476441-973c2a23-d0fe-4742-8d6c-df5b52635a97.png" width="300" alt="Screenshot">
<img src="https://user-images.githubusercontent.com/13404752/174476492-0ffbb49e-f903-4663-9b34-79f91c1c33ed.png" width="300" alt="Screenshot">
<img src="https://user-images.githubusercontent.com/13404752/110204822-1b29cc00-7eb0-11eb-8a95-a7c3ca7aa472.png" width="300" alt="Screenshot">
## 资源
- [Mohammad Reza Farahzad 的设计](https://dribbble.com/shots/14028358-VPN-App-Ui-Design?utm_source=Clipboard_Shot&utm_campaign=mrfarahzad&utm_content=VPN%20App%20Ui%20Design&utm_medium=Social_Share)
- [flat flags](https://github.com/wobblecode/flat-flags)
## 联络我
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/sail-tunnel)
[![Gmail](https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:sail-tunnel@gmail.com)
## 待办事项:
- [x] 支持安卓设备。
- [ ] Dart ffi 与 iOS 和 android 来控制 vpn。
- [x] 订单页面
- [x] 我的设置页面
- [x] 服务器列表页面支持 ping 操作。
- [ ] 按Material主题重构颜色。
## 环境
- Flutter 3.0.1
- Dart 2.17.1
- macOS 12.4
- IntelliJ IDEA 2022.1.1 (Ultimate Edition) (感谢 [jetbrains 开源计划](https://www.jetbrains.com/opensource/))
- Xcode 13.4.1
- iOS 15.5
## 安装
```shell
flutter pub get
```
## 开发
```shell
flutter run
```
## 构建
build android apk
```shell
flutter build apk
```
build ios
```shell
flutter build ios
```
@@ -22,7 +22,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant
import java.io.File
class MainActivity: FlutterActivity() {
private val channel = "com.sail_tunnel.sail/vpn_manager"
private val channel = "com.vpntunnel.vpnzeus/vpn_manager"
private fun getServiceIntent(): Intent {
return Intent(this, TunnelService::class.java)
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
*.a filter=lfs diff=lfs merge=lfs -text
@@ -8,7 +8,7 @@
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.sail-tunnel.vpnzeus</string>
<string>group.com.vpntunnel.vpnzeus</string>
</array>
</dict>
</plist>
+1 -1
View File
@@ -33,7 +33,7 @@ target 'Runner' do
use_frameworks!
use_modular_headers!
# pod 'Leaf', :path => 'leaf.xcframework'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
+3 -3
View File
@@ -26,7 +26,7 @@ PODS:
- PhoneNumberKit/PhoneNumberKitCore
- shared_preferences_ios (0.0.1):
- Flutter
- Toast (4.0.0)
- Toast (4.1.1)
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
@@ -79,10 +79,10 @@ SPEC CHECKSUMS:
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
PhoneNumberKit: ced55861269312a5e3bc2ef82a58d6255b1c976a
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
PODFILE CHECKSUM: 2cac2355308eef43139d5b34f7a00e0eaa241759
PODFILE CHECKSUM: de47e8edb5f824045744e95e4ae955933333d4a0
COCOAPODS: 1.15.2
+30 -24
View File
@@ -32,9 +32,9 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C09C70752C3E5685000F6E01 /* leaf.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0CB10F52C3275EE00A1F217 /* leaf.xcframework */; };
C09C70762C3E5685000F6E01 /* leaf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C0CB10F52C3275EE00A1F217 /* leaf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C0CB10F62C3275EE00A1F217 /* leaf.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0CB10F52C3275EE00A1F217 /* leaf.xcframework */; };
C0CB10F82C3276C300A1F217 /* leaf.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0CB10F52C3275EE00A1F217 /* leaf.xcframework */; };
C0CB10F92C3276C300A1F217 /* leaf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C0CB10F52C3275EE00A1F217 /* leaf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DBC6F25A26C78B1D91884CE1 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A9C0075B77637136AF52D8B /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
@@ -70,13 +70,13 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
C0CB10F42C3275A300A1F217 /* Embed Frameworks */ = {
C09C70772C3E5685000F6E01 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
C0CB10F92C3276C300A1F217 /* leaf.xcframework in Embed Frameworks */,
C09C70762C3E5685000F6E01 /* leaf.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -110,7 +110,6 @@
3EA6B277293F1D1600B2BABC /* URL+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Helpers.swift"; sourceTree = "<group>"; };
3EA6B279293F1FAD00B2BABC /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
4A9C0075B77637136AF52D8B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7F9A79C99E6BB92BFA8F918D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
@@ -123,6 +122,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C00A39D82C3E5F9D004E31E4 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
C0CB10F52C3275EE00A1F217 /* leaf.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = leaf.xcframework; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -131,8 +131,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C0CB10F82C3276C300A1F217 /* leaf.xcframework in Frameworks */,
7A31DD8228420C0B00E82EE1 /* NetworkExtension.framework in Frameworks */,
C09C70752C3E5685000F6E01 /* leaf.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -235,7 +235,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
C00A39D82C3E5F9D004E31E4 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
@@ -260,8 +260,8 @@
2FD21F0925A363E300F556E0 /* Sources */,
2FD21F0A25A363E300F556E0 /* Frameworks */,
C0DAE5F52C3272280023769C /* CopyFiles */,
C0CB10F42C3275A300A1F217 /* Embed Frameworks */,
2FD21F0B25A363E300F556E0 /* Resources */,
C09C70772C3E5685000F6E01 /* Embed Frameworks */,
);
buildRules = (
);
@@ -282,9 +282,9 @@
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
30B17F94E53B12A0859D0A8C /* [CP] Embed Pods Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9740EEB61CF901F6004384FC /* Run Script */,
30B17F94E53B12A0859D0A8C /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -554,7 +554,8 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
CURRENT_PROJECT_VERSION = 222;
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -563,7 +564,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = UUVPN;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -572,8 +573,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.0.0;
MODULEMAP_FILE = "${PROJECT_DIR}/LeafFFI/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -600,7 +602,7 @@
CODE_SIGN_ENTITLEMENTS = PacketTunnel/PacketTunnel.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 200;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
FRAMEWORK_SEARCH_PATHS = (
@@ -619,7 +621,7 @@
MARKETING_VERSION = 1.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus.PacketTunnel";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus.PacketTunnel;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -643,7 +645,7 @@
CODE_SIGN_ENTITLEMENTS = PacketTunnel/PacketTunnel.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 200;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
FRAMEWORK_SEARCH_PATHS = (
@@ -661,7 +663,7 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 1.0.6;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus.PacketTunnel";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus.PacketTunnel;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "";
@@ -683,7 +685,7 @@
CODE_SIGN_ENTITLEMENTS = PacketTunnel/PacketTunnel.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 200;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
FRAMEWORK_SEARCH_PATHS = (
@@ -701,7 +703,7 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 1.0.6;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus.PacketTunnel";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus.PacketTunnel;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "";
@@ -833,7 +835,8 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
CURRENT_PROJECT_VERSION = 222;
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -842,7 +845,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = UUVPN;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -851,8 +854,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.0.0;
MODULEMAP_FILE = "${PROJECT_DIR}/LeafFFI/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -877,7 +881,8 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
CURRENT_PROJECT_VERSION = 222;
DEVELOPMENT_TEAM = 26XWXKSR3B;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -886,7 +891,7 @@
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = UUVPN;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -895,8 +900,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.0.0;
MODULEMAP_FILE = "${PROJECT_DIR}/LeafFFI/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = "com.sail-tunnel.vpnzeus";
PRODUCT_BUNDLE_IDENTIFIER = com.vpntunnel.vpnzeus;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+1 -1
View File
@@ -12,7 +12,7 @@ import os
GeneratedPluginRegistrant.register(with: self)
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController;
let vpnManagerChannel = FlutterMethodChannel.init(name: "com.sail_tunnel.sail/vpn_manager",
let vpnManagerChannel = FlutterMethodChannel.init(name: "com.vpntunnel.vpnzeus/vpn_manager",
binaryMessenger: controller.binaryMessenger);
let manager = VPNManager.shared()
+1
View File
@@ -30,6 +30,7 @@
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
@@ -1 +1,12 @@
//
// Runner-Bridging-Header.h
// Runner
//
// Created by Zeus on 2024/7/10.
//
#ifndef Runner_Bridging_Header_h
#define Runner_Bridging_Header_h
#import "GeneratedPluginRegistrant.h"
#endif /* Runner_Bridging_Header_h */
+1 -1
View File
@@ -10,7 +10,7 @@
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.sail-tunnel.vpnzeus</string>
<string>group.com.vpntunnel.vpnzeus</string>
</array>
</dict>
</plist>
@@ -8,7 +8,7 @@
import Foundation
extension FileManager {
static var appGroupId = "group.com.sail-tunnel.vpnzeus"
static var appGroupId = "group.com.vpntunnel.vpnzeus"
private var sharedFolderURL: URL? {
let appGroupId = FileManager.appGroupId
Binary file not shown.
+65
View File
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>libleaf.a</string>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>libleaf.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>libleaf.a</string>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libleaf.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>libleaf.a</string>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libleaf.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
@@ -0,0 +1,119 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
/**
* No error.
*/
#define ERR_OK 0
/**
* Config path error.
*/
#define ERR_CONFIG_PATH 1
/**
* Config parsing error.
*/
#define ERR_CONFIG 2
/**
* IO error.
*/
#define ERR_IO 3
/**
* Config file watcher error.
*/
#define ERR_WATCHER 4
/**
* Async channel send error.
*/
#define ERR_ASYNC_CHANNEL_SEND 5
/**
* Sync channel receive error.
*/
#define ERR_SYNC_CHANNEL_RECV 6
/**
* Runtime manager error.
*/
#define ERR_RUNTIME_MANAGER 7
/**
* No associated config file.
*/
#define ERR_NO_CONFIG_FILE 8
/**
* Starts leaf with options, on a successful start this function blocks the current
* thread.
*
* @note This is not a stable API, parameters will change from time to time.
*
* @param rt_id A unique ID to associate this leaf instance, this is required when
* calling subsequent FFI functions, e.g. reload, shutdown.
* @param config_path The path of the config file, must be a file with suffix .conf
* or .json, according to the enabled features.
* @param auto_reload Enabls auto reloading when config file changes are detected,
* takes effect only when the "auto-reload" feature is enabled.
* @param multi_thread Whether to use a multi-threaded runtime.
* @param auto_threads Sets the number of runtime worker threads automatically,
* takes effect only when multi_thread is true.
* @param threads Sets the number of runtime worker threads, takes effect when
* multi_thread is true, but can be overridden by auto_threads.
* @param stack_size Sets stack size of the runtime worker threads, takes effect when
* multi_thread is true.
* @return ERR_OK on finish running, any other errors means a startup failure.
*/
int32_t leaf_run_with_options(uint16_t rt_id,
const char *config_path,
bool auto_reload,
bool multi_thread,
bool auto_threads,
int32_t threads,
int32_t stack_size);
/**
* Starts leaf with a single-threaded runtime, on a successful start this function
* blocks the current thread.
*
* @param rt_id A unique ID to associate this leaf instance, this is required when
* calling subsequent FFI functions, e.g. reload, shutdown.
* @param config_path The path of the config file, must be a file with suffix .conf
* or .json, according to the enabled features.
* @return ERR_OK on finish running, any other errors means a startup failure.
*/
int32_t leaf_run(uint16_t rt_id, const char *config_path);
int32_t leaf_run_with_config_string(uint16_t rt_id, const char *config);
/**
* Reloads DNS servers, outbounds and routing rules from the config file.
*
* @param rt_id The ID of the leaf instance to reload.
*
* @return Returns ERR_OK on success.
*/
int32_t leaf_reload(uint16_t rt_id);
/**
* Shuts down leaf.
*
* @param rt_id The ID of the leaf instance to reload.
*
* @return Returns true on success, false otherwise.
*/
bool leaf_shutdown(uint16_t rt_id);
/**
* Tests the configuration.
*
* @param config_path The path of the config file, must be a file with suffix .conf
* or .json, according to the enabled features.
* @return Returns ERR_OK on success, i.e no syntax error.
*/
int32_t leaf_test_config(const char *config_path);
@@ -0,0 +1,4 @@
module leaf {
header "leaf.h"
export *
}
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2dbcc15712911277195419d6de4edfbeecb9cc6d61a2608aa506cf0392b3714f
size 121253696
+6 -6
View File
@@ -18,7 +18,7 @@ enum VpnStatus {
class VpnManager {
Future<VpnStatus> getStatus() async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
if (Platform.isAndroid || Platform.isMacOS) {
bool? result = await platform.invokeMethod("getStatus");
// print("${result}");
@@ -40,7 +40,7 @@ class VpnManager {
Future<DateTime> getConnectedDate() async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
double result;
try {
if (Platform.isAndroid || Platform.isMacOS) {
@@ -58,7 +58,7 @@ class VpnManager {
Future<bool> toggle() async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
bool result = false;
try {
result = await platform.invokeMethod("toggle");
@@ -72,7 +72,7 @@ class VpnManager {
Future<String> getTunnelLog() async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
String result;
try {
result = await platform.invokeMethod("getTunnelLog");
@@ -86,7 +86,7 @@ class VpnManager {
Future<String> getTunnelConfiguration() async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
String result;
try {
result = await platform.invokeMethod("getTunnelConfiguration");
@@ -100,7 +100,7 @@ class VpnManager {
Future<String> setTunnelConfiguration(String conf) async {
// Native channel
const platform = MethodChannel("com.sail_tunnel.sail/vpn_manager");
const platform = MethodChannel("com.vpntunnel.vpnzeus/vpn_manager");
String result;
try {
result = await platform.invokeMethod("setTunnelConfiguration", conf);