Skip to content

Commit

Permalink
Bump version 0.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Mar 30, 2024
1 parent 9bd223d commit 65a085e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish-exe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
elif [[ "${{ matrix.host_os }}" == "macos-latest" ]]; then
zip -j mypubdir4/socks-hub-${{ matrix.target }}.zip target/${{ matrix.target }}/release/socks-hub ./README.md ./socks_hub_ffi.h target/${{ matrix.target }}/release/libsocks_hub.dylib
if [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
./build-aarch64-apple-ios.sh
zip -r mypubdir4/socks-hub-aarch64-apple-ios-xcframework.zip ./socks-hub.xcframework/
./build-apple.sh
zip -r mypubdir4/socks-hub-apple-xcframework.zip ./socks-hub.xcframework/
fi
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "socks-hub"
version = "0.1.12"
version = "0.1.13"
license = "MIT"
repository = "https://github.com/ssrlive/socks-hub"
homepage = "https://github.com/ssrlive/socks-hub"
Expand Down
2 changes: 1 addition & 1 deletion build-apple-debug.sh → build-aarch64-apple-ios-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "Generating includes..."
mkdir -p target/include/
rm -rf target/include/*
cbindgen --config cbindgen.toml -l C -o target/include/socks-hub.h
cat > target/include/module.modulemap <<EOF
cat > target/include/socks-hub.modulemap <<EOF
framework module socks-hub {
umbrella header "socks-hub.h"
Expand Down
27 changes: 27 additions & 0 deletions build-aarch64-apple-ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/sh

echo "Setting up the rust environment..."
rustup target add aarch64-apple-ios
cargo install cbindgen

echo "Building target aarch64-apple-ios..."
cargo build --release --target aarch64-apple-ios

echo "Generating includes..."
mkdir -p target/include/
rm -rf target/include/*
cbindgen --config cbindgen.toml -l C -o target/include/socks-hub.h
cat > target/include/socks-hub.modulemap <<EOF
framework module socks-hub {
umbrella header "socks-hub.h"
export *
module * { export * }
}
EOF

echo "Creating XCFramework"
rm -rf ./socks-hub.xcframework
xcodebuild -create-xcframework \
-library ./target/aarch64-apple-ios/release/libsocks_hub.a -headers ./target/include/ \
-output ./socks-hub.xcframework
2 changes: 1 addition & 1 deletion build-apple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "Generating includes..."
mkdir -p target/include/
rm -rf target/include/*
cbindgen --config cbindgen.toml -l C -o target/include/socks-hub.h
cat > target/include/module.modulemap <<EOF
cat > target/include/socks-hub.modulemap <<EOF
framework module socks-hub {
umbrella header "socks-hub.h"
Expand Down
10 changes: 7 additions & 3 deletions cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ language = "C"

[export]
include = ["socks_hub_run", "socks_hub_set_log_callback", "socks_hub_stop"]
# exclude = ["Java_com_github_shadowsocks_bg_run", "Java_com_github_shadowsocks_bg_stop"]
exclude = []

[defines]
# "feature = sockshub" = "DEFINE_SOCKSHUB"
[export.rename]
"ArgVerbosity" = "SocksHubVerbosity"
"ProxyType" = "SocksHubProxyType"

[enum]
prefix_with_name = true
4 changes: 3 additions & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ pub unsafe extern "C" fn socks_hub_run(
ctx: *mut c_void,
) -> c_int {
log::set_max_level(verbosity.into());
log::set_boxed_logger(Box::<crate::dump_logger::DumpLogger>::default()).unwrap();
if let Err(err) = log::set_boxed_logger(Box::<crate::dump_logger::DumpLogger>::default()) {
log::error!("Failed to set logger: {}", err);
}

let local_addr = std::ffi::CStr::from_ptr(local_addr).to_str().unwrap();
let local_addr = local_addr.parse().unwrap();
Expand Down

0 comments on commit 65a085e

Please sign in to comment.