111
This commit is contained in:
Zeus
2023-12-05 14:46:51 +08:00
parent ae3e4546c9
commit 314b2ba45e
40 changed files with 195 additions and 16 deletions
Binary file not shown.
@@ -126,7 +126,7 @@
</data>
<key>flutter_assets/kernel_blob.bin</key>
<data>
jym4/NxmECxe9MlXWVFNZC61N3g=
6pJRW026kNsLc0v6WeviInVnrHI=
</data>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data>
@@ -418,7 +418,7 @@
<dict>
<key>hash2</key>
<data>
pG+yFCaSbrWyV8OJH2qu8NbAPKJtYfiEYXUB+TkE/vE=
28pkzgqVfaChsXd5VW5Am/wg4n7a5CpeV5KJf51hySA=
</data>
</dict>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
@@ -4,6 +4,10 @@
<dict>
<key>files</key>
<dict>
<key>Frameworks/libleaf.a</key>
<data>
F1ShttoOv/CJ/eer2xE4AYhIE7g=
</data>
<key>Info.plist</key>
<data>
pEugHzA72YXqVw69al3Su5llsFs=
@@ -14,11 +18,18 @@
</data>
<key>template.conf</key>
<data>
LOeIFA2FHTHhGDBhsE9D8DEG3RM=
flePUpO6sJtbJmzKYBwl/U4fGj0=
</data>
</dict>
<key>files2</key>
<dict>
<key>Frameworks/libleaf.a</key>
<dict>
<key>hash2</key>
<data>
rEU/O0bFg9K7FN3dBcm8v4tlX7Goh9/JMLrCpdWwEA4=
</data>
</dict>
<key>embedded.mobileprovision</key>
<dict>
<key>hash2</key>
@@ -30,7 +41,7 @@
<dict>
<key>hash2</key>
<data>
3m0q7TR1zEV0ZFcNdaxSjhLfQ4CkcAF7Mlb5E2IcoDQ=
iXkNNoAOuDJ1FRI1QsLeG9fUOYUVusMhCFdjxcLuUGQ=
</data>
</dict>
</dict>
@@ -4,6 +4,8 @@ logoutput = {{leafLogFile}}
dns-server = 223.5.5.5, 114.114.114.114
tun-fd = {{tunFd}}
routing-domain-resolve = true
socks-interface = 127.0.0.1
socks-port = 1080
[Proxy]
Direct = direct
@@ -126,7 +126,7 @@
</data>
<key>flutter_assets/kernel_blob.bin</key>
<data>
jym4/NxmECxe9MlXWVFNZC61N3g=
6pJRW026kNsLc0v6WeviInVnrHI=
</data>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data>
@@ -418,7 +418,7 @@
<dict>
<key>hash2</key>
<data>
pG+yFCaSbrWyV8OJH2qu8NbAPKJtYfiEYXUB+TkE/vE=
28pkzgqVfaChsXd5VW5Am/wg4n7a5CpeV5KJf51hySA=
</data>
</dict>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
@@ -4,6 +4,10 @@
<dict>
<key>files</key>
<dict>
<key>Frameworks/libleaf.a</key>
<data>
F1ShttoOv/CJ/eer2xE4AYhIE7g=
</data>
<key>Info.plist</key>
<data>
pEugHzA72YXqVw69al3Su5llsFs=
@@ -14,11 +18,18 @@
</data>
<key>template.conf</key>
<data>
LOeIFA2FHTHhGDBhsE9D8DEG3RM=
flePUpO6sJtbJmzKYBwl/U4fGj0=
</data>
</dict>
<key>files2</key>
<dict>
<key>Frameworks/libleaf.a</key>
<dict>
<key>hash2</key>
<data>
rEU/O0bFg9K7FN3dBcm8v4tlX7Goh9/JMLrCpdWwEA4=
</data>
</dict>
<key>embedded.mobileprovision</key>
<dict>
<key>hash2</key>
@@ -30,7 +41,7 @@
<dict>
<key>hash2</key>
<data>
3m0q7TR1zEV0ZFcNdaxSjhLfQ4CkcAF7Mlb5E2IcoDQ=
iXkNNoAOuDJ1FRI1QsLeG9fUOYUVusMhCFdjxcLuUGQ=
</data>
</dict>
</dict>
@@ -4,6 +4,8 @@ logoutput = {{leafLogFile}}
dns-server = 223.5.5.5, 114.114.114.114
tun-fd = {{tunFd}}
routing-domain-resolve = true
socks-interface = 127.0.0.1
socks-port = 1080
[Proxy]
Direct = direct
Binary file not shown.
@@ -4,6 +4,8 @@ logoutput = {{leafLogFile}}
dns-server = 223.5.5.5, 114.114.114.114
tun-fd = {{tunFd}}
routing-domain-resolve = true
socks-interface = 127.0.0.1
socks-port = 1080
[Proxy]
Direct = direct
@@ -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 *
}
+1 -1
View File
@@ -1 +1 @@
{"files":{"/Users/abc123456/Documents/ios/UUVPN/flutter/ios/Runner.xcodeproj/project.pbxproj":"343711c09b58309400e22b4efcd5afbf","/Users/abc123456/Documents/ios/UUVPN/flutter/ios/Podfile":"383dfd623c640015e6ccddecc8b7dadd","/Users/abc123456/Documents/ios/flutter/packages/flutter_tools/bin/podhelper.rb":"af3a512eb831d2c2ac92467a86bb79a2"}}
{"files":{"/Users/abc123456/Documents/ios/UUVPN/flutter/ios/Runner.xcodeproj/project.pbxproj":"17cef6eaa78e266a2b774881b450131c","/Users/abc123456/Documents/ios/UUVPN/flutter/ios/Podfile":"383dfd623c640015e6ccddecc8b7dadd","/Users/abc123456/Documents/ios/flutter/packages/flutter_tools/bin/podhelper.rb":"af3a512eb831d2c2ac92467a86bb79a2"}}