Skip to content

Commit

Permalink
Bump version 0.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Mar 24, 2024
1 parent 63630f7 commit 9bd223d
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-exe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
powershell Compress-Archive -Path target/${{ matrix.target }}/release/socks-hub.exe, ./README.md, ./socks_hub_ffi.h, target/${{ matrix.target }}/release/socks_hub.dll -DestinationPath mypubdir4/socks-hub-${{ matrix.target }}.zip
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-apple.sh
zip -r mypubdir4/socks-hub-apple-xcframework.zip ./socks-hub.xcframework/
fi
elif [[ "${{ matrix.host_os }}" == "ubuntu-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.so
fi
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Documentation](https://img.shields.io/badge/docs-release-brightgreen.svg?style=flat)](https://docs.rs/socks-hub)
[![Download](https://img.shields.io/crates/d/socks-hub.svg)](https://crates.io/crates/socks-hub)
[![License](https://img.shields.io/crates/l/socks-hub.svg?style=flat)](https://github.com/ssrlive/socks-hub/blob/master/LICENSE)
[![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg?maxAge=3600)](https://github.com/ssrlive/socks-hub)

`SOCKS-HUB` is a [SOCKS5](https://en.wikipedia.org/wiki/SOCKS#SOCKS5) proxy `hub`.
It can convert `HTTP`/`HTTPS` proxy to `SOCKS5` proxy, and can also forward `SOCKS5` proxy.
Expand Down Expand Up @@ -38,12 +39,12 @@ Usage: socks-hub [OPTIONS] --listen-addr <IP:port> --server-addr <IP:port>
Options:
-t, --source-type <http|socks5> Source proxy type [default: http] [possible values: http, socks5]
-l, --listen-addr <IP:port> Local listening address
-s, --server-addr <IP:port> Remote SOCKS5 server address
-u, --username <username> Client authentication username, available both for HTTP and SOCKS5, optional
-p, --password <password> Client authentication password, available both for HTTP and SOCKS5, optional
--s5-username <username> SOCKS5 server authentication username, optional
--s5-password <password> SOCKS5 server authentication password, optional
-a, --acl-file <path> ACL file path
-s, --server-addr <IP:port> Remote SOCKS5 server address
--s5-username <username> Remote SOCKS5 server authentication username, optional
--s5-password <password> Remote SOCKS5 server authentication password, optional
-a, --acl-file <path> ACL (Access Control List) file path, optional
-v, --verbosity <level> Log verbosity level [default: info] [possible values: off, error, warn, info, debug, trace]
-h, --help Print help
-V, --version Print version
Expand Down
27 changes: 27 additions & 0 deletions build-apple-debug.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 --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/module.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/debug/libsocks_hub.a -headers ./target/include/ \
-output ./socks-hub.xcframework
57 changes: 57 additions & 0 deletions build-apple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#! /bin/sh

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

echo "Building..."

echo "Building target x86_64-apple-darwin..."
cargo build --release --target x86_64-apple-darwin

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

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

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

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

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
framework module socks-hub {
umbrella header "socks-hub.h"
export *
module * { export * }
}
EOF

echo "lipo..."

echo "Simulator"
lipo -create \
target/aarch64-apple-ios-sim/release/libsocks_hub.a \
target/x86_64-apple-ios/release/libsocks_hub.a \
-output ./target/libsocks_hub-ios-sim.a

echo "MacOS"
lipo -create \
target/aarch64-apple-darwin/release/libsocks_hub.a \
target/x86_64-apple-darwin/release/libsocks_hub.a \
-output ./target/libsocks_hub-macos.a

echo "Creating XCFramework"
rm -rf ./socks-hub.xcframework
xcodebuild -create-xcframework \
-library ./target/aarch64-apple-ios/release/libsocks_hub.a -headers ./target/include/ \
-library ./target/libsocks_hub-ios-sim.a -headers ./target/include/ \
-library ./target/libsocks_hub-macos.a -headers ./target/include/ \
-output ./socks-hub.xcframework
5 changes: 5 additions & 0 deletions cbindgen.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
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"]

[defines]
# "feature = sockshub" = "DEFINE_SOCKSHUB"

0 comments on commit 9bd223d

Please sign in to comment.