mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 01:05:19 +00:00
Replace C Tor with Rust Arti for Tor integration
- Replace C Tor (0.4.8.21) with Rust Arti (1.9.0/arti-client 0.38) - 70% smaller binary: 21MB xcframework vs 67MB (6.9MB vs 14MB per slice) - Memory-safe Rust implementation with modern async (tokio) - Same SOCKS5 proxy interface at 127.0.0.1:39050 for drop-in compatibility - FFI wrapper (arti-bitchat crate) with C-compatible exports - Swift TorManager maintains identical public API - Aggressive size optimization: opt-level=z, lto=fat, panic=abort, strip - Supports iOS device, iOS simulator (Apple Silicon), and macOS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?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>libarti_bitchat.a</string>
|
||||
<key>HeadersPath</key>
|
||||
<string>Headers</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>macos-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libarti_bitchat.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>macos</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>libarti_bitchat.a</string>
|
||||
<key>HeadersPath</key>
|
||||
<string>Headers</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libarti_bitchat.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>libarti_bitchat.a</string>
|
||||
<key>HeadersPath</key>
|
||||
<string>Headers</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libarti_bitchat.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</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>
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#ifndef ARTI_H
|
||||
#define ARTI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* Start Arti with a SOCKS5 proxy.
|
||||
*
|
||||
* # Arguments
|
||||
* * `data_dir` - Path to data directory for Tor state (C string)
|
||||
* * `socks_port` - Port for SOCKS5 proxy (e.g., 39050)
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if already running
|
||||
* * -2 if data_dir is invalid
|
||||
* * -3 if runtime initialization failed
|
||||
* * -4 if bootstrap failed
|
||||
*/
|
||||
int arti_start(const char *data_dir, uint16_t socks_port);
|
||||
|
||||
/**
|
||||
* Stop Arti gracefully.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_stop(void);
|
||||
|
||||
/**
|
||||
* Check if Arti is currently running.
|
||||
*
|
||||
* # Returns
|
||||
* * 1 if running
|
||||
* * 0 if not running
|
||||
*/
|
||||
int arti_is_running(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap progress (0-100).
|
||||
*/
|
||||
int arti_bootstrap_progress(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap summary string.
|
||||
*
|
||||
* # Arguments
|
||||
* * `buf` - Buffer to write the summary into
|
||||
* * `len` - Length of the buffer
|
||||
*
|
||||
* # Returns
|
||||
* * Number of bytes written (not including null terminator)
|
||||
* * -1 if buffer is null or too small
|
||||
*/
|
||||
int arti_bootstrap_summary(char *buf, int len);
|
||||
|
||||
/**
|
||||
* Signal Arti to go dormant (reduce resource usage).
|
||||
* This is a hint; Arti may not fully support dormant mode yet.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_go_dormant(void);
|
||||
|
||||
/**
|
||||
* Signal Arti to wake from dormant mode.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_wake(void);
|
||||
|
||||
#endif /* ARTI_H */
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,78 @@
|
||||
#ifndef ARTI_H
|
||||
#define ARTI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* Start Arti with a SOCKS5 proxy.
|
||||
*
|
||||
* # Arguments
|
||||
* * `data_dir` - Path to data directory for Tor state (C string)
|
||||
* * `socks_port` - Port for SOCKS5 proxy (e.g., 39050)
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if already running
|
||||
* * -2 if data_dir is invalid
|
||||
* * -3 if runtime initialization failed
|
||||
* * -4 if bootstrap failed
|
||||
*/
|
||||
int arti_start(const char *data_dir, uint16_t socks_port);
|
||||
|
||||
/**
|
||||
* Stop Arti gracefully.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_stop(void);
|
||||
|
||||
/**
|
||||
* Check if Arti is currently running.
|
||||
*
|
||||
* # Returns
|
||||
* * 1 if running
|
||||
* * 0 if not running
|
||||
*/
|
||||
int arti_is_running(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap progress (0-100).
|
||||
*/
|
||||
int arti_bootstrap_progress(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap summary string.
|
||||
*
|
||||
* # Arguments
|
||||
* * `buf` - Buffer to write the summary into
|
||||
* * `len` - Length of the buffer
|
||||
*
|
||||
* # Returns
|
||||
* * Number of bytes written (not including null terminator)
|
||||
* * -1 if buffer is null or too small
|
||||
*/
|
||||
int arti_bootstrap_summary(char *buf, int len);
|
||||
|
||||
/**
|
||||
* Signal Arti to go dormant (reduce resource usage).
|
||||
* This is a hint; Arti may not fully support dormant mode yet.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_go_dormant(void);
|
||||
|
||||
/**
|
||||
* Signal Arti to wake from dormant mode.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_wake(void);
|
||||
|
||||
#endif /* ARTI_H */
|
||||
Binary file not shown.
@@ -0,0 +1,78 @@
|
||||
#ifndef ARTI_H
|
||||
#define ARTI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* Start Arti with a SOCKS5 proxy.
|
||||
*
|
||||
* # Arguments
|
||||
* * `data_dir` - Path to data directory for Tor state (C string)
|
||||
* * `socks_port` - Port for SOCKS5 proxy (e.g., 39050)
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if already running
|
||||
* * -2 if data_dir is invalid
|
||||
* * -3 if runtime initialization failed
|
||||
* * -4 if bootstrap failed
|
||||
*/
|
||||
int arti_start(const char *data_dir, uint16_t socks_port);
|
||||
|
||||
/**
|
||||
* Stop Arti gracefully.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_stop(void);
|
||||
|
||||
/**
|
||||
* Check if Arti is currently running.
|
||||
*
|
||||
* # Returns
|
||||
* * 1 if running
|
||||
* * 0 if not running
|
||||
*/
|
||||
int arti_is_running(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap progress (0-100).
|
||||
*/
|
||||
int arti_bootstrap_progress(void);
|
||||
|
||||
/**
|
||||
* Get the current bootstrap summary string.
|
||||
*
|
||||
* # Arguments
|
||||
* * `buf` - Buffer to write the summary into
|
||||
* * `len` - Length of the buffer
|
||||
*
|
||||
* # Returns
|
||||
* * Number of bytes written (not including null terminator)
|
||||
* * -1 if buffer is null or too small
|
||||
*/
|
||||
int arti_bootstrap_summary(char *buf, int len);
|
||||
|
||||
/**
|
||||
* Signal Arti to go dormant (reduce resource usage).
|
||||
* This is a hint; Arti may not fully support dormant mode yet.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_go_dormant(void);
|
||||
|
||||
/**
|
||||
* Signal Arti to wake from dormant mode.
|
||||
*
|
||||
* # Returns
|
||||
* * 0 on success
|
||||
* * -1 if not running
|
||||
*/
|
||||
int arti_wake(void);
|
||||
|
||||
#endif /* ARTI_H */
|
||||
Binary file not shown.
Reference in New Issue
Block a user