Bump version 0.2.15

This commit is contained in:
ssrlive 2024-03-30 12:30:01 +08:00
parent 4adc38c726
commit ce0c02b3bf
9 changed files with 58 additions and 8 deletions

View file

@ -70,6 +70,8 @@ jobs:
elif [[ "${{ matrix.host_os }}" == "macos-latest" ]]; then
zip -j mypubdir4/tun2proxy-${{ matrix.target }}.zip target/${{ matrix.target }}/release/tun2proxy README.md target/tun2proxy-ffi.h target/${{ matrix.target }}/release/libtun2proxy.dylib
if [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
./build-aarch64-apple-ios.sh
zip -r mypubdir4/tun2proxy-aarch64-apple-ios-xcframework.zip ./tun2proxy.xcframework/
./build-apple.sh
zip -r mypubdir4/tun2proxy-apple-xcframework.zip ./tun2proxy.xcframework/
fi

View file

@ -1,6 +1,6 @@
[package]
name = "tun2proxy"
version = "0.2.14"
version = "0.2.15"
edition = "2021"
license = "MIT"
repository = "https://github.com/blechschmidt/tun2proxy"

View file

@ -11,7 +11,7 @@ echo "Generating includes..."
mkdir -p target/include/
rm -rf target/include/*
cbindgen --config cbindgen.toml -l C -o target/include/tun2proxy.h
cat > target/include/module.modulemap <<EOF
cat > target/include/tun2proxy.modulemap <<EOF
framework module tun2proxy {
umbrella header "tun2proxy.h"

27
build-aarch64-apple-ios.sh Executable file
View file

@ -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/tun2proxy.h
cat > target/include/tun2proxy.modulemap <<EOF
framework module tun2proxy {
umbrella header "tun2proxy.h"
export *
module * { export * }
}
EOF
echo "Creating XCFramework"
rm -rf ./tun2proxy.xcframework
xcodebuild -create-xcframework \
-library ./target/aarch64-apple-ios/release/libtun2proxy.a -headers ./target/include/ \
-output ./tun2proxy.xcframework

View file

@ -5,16 +5,27 @@ rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios x86_6
cargo install cbindgen
echo "Building..."
echo "cargo build --release --target x86_64-apple-darwin"
cargo build --release --target x86_64-apple-darwin
echo "cargo build --release --target aarch64-apple-darwin"
cargo build --release --target aarch64-apple-darwin
echo "cargo build --release --target aarch64-apple-ios"
cargo build --release --target aarch64-apple-ios
echo "cargo build --release --target x86_64-apple-ios"
cargo build --release --target x86_64-apple-ios
echo "cargo build --release --target x86_64-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/tun2proxy.h
cat > target/include/module.modulemap <<EOF
cat > target/include/tun2proxy.modulemap <<EOF
framework module tun2proxy {
umbrella header "tun2proxy.h"

View file

@ -10,3 +10,10 @@ exclude = [
"Java_com_github_shadowsocks_bg_Tun2proxy_run",
"Java_com_github_shadowsocks_bg_Tun2proxy_stop",
]
[export.rename]
"ArgVerbosity" = "Tun2proxyVerbosity"
"ArgDns" = "Tun2proxyDns"
[enum]
prefix_with_name = true

View file

@ -11,7 +11,7 @@ use std::os::raw::{c_char, c_int, c_ushort};
/// Run the tun2proxy component with some arguments.
/// Parameters:
/// - proxy_url: the proxy url, e.g. "socks5://127.0.0.1:1080"
/// - tun_fd: the tun file descriptor
/// - tun_fd: the tun file descriptor, it will be owned by tun2proxy
/// - packet_information: whether exists packet information in tun_fd
/// - tun_mtu: the tun mtu
/// - dns_strategy: the dns strategy, see ArgDns enum
@ -26,7 +26,9 @@ pub unsafe extern "C" fn tun2proxy_with_fd_run(
verbosity: ArgVerbosity,
) -> 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 proxy_url = std::ffi::CStr::from_ptr(proxy_url).to_str().unwrap();
let proxy = ArgProxy::from_url(proxy_url).unwrap();

View file

@ -42,7 +42,9 @@ pub unsafe extern "C" fn tun2proxy_with_name_run(
}
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!("set logger error: {}", err);
}
let proxy_url = std::ffi::CStr::from_ptr(proxy_url).to_str().unwrap();
let proxy = ArgProxy::from_url(proxy_url).unwrap();

View file

@ -41,9 +41,8 @@ pub fn mobile_run(args: Args, tun_mtu: u16, _packet_information: bool) -> c_int
config.tun_name(tun);
}
#[cfg(unix)]
#[cfg(any(target_os = "ios", target_os = "macos"))]
config.platform_config(|config| {
#[allow(deprecated)]
config.packet_information(_packet_information);
});