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
+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