From 6c8ae7a33fb9f89a3965e9e894f0f7f431fa03b1 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:54:54 +0800 Subject: [PATCH] rename target from 'tun2proxy' to 'tun2proxy-bin' make rust compiler happy --- .github/workflows/publish-exe.yml | 6 +++--- Cargo.toml | 2 +- Dockerfile | 4 ++-- README.md | 16 ++++++++-------- scripts/iperf3.sh | 4 ++-- scripts/linux.sh | 2 +- scripts/rperf.sh | 4 ++-- src/bin/main.rs | 2 +- tests/iperf/test.sh | 4 ++-- tests/tests.py | 4 ++-- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/publish-exe.yml b/.github/workflows/publish-exe.yml index 87f5a5a..b81cae7 100644 --- a/.github/workflows/publish-exe.yml +++ b/.github/workflows/publish-exe.yml @@ -74,9 +74,9 @@ jobs: if [[ "${{ matrix.host_os }}" == "windows-latest" ]]; then powershell -Command "(Get-Item README.md).LastWriteTime = Get-Date" powershell -Command "(Get-Item target/${{ matrix.target }}/release/wintun.dll).LastWriteTime = Get-Date" - powershell Compress-Archive -Path target/${{ matrix.target }}/release/tun2proxy.exe, README.md, target/tun2proxy-ffi.h, target/${{ matrix.target }}/release/tun2proxy.dll, target/${{ matrix.target }}/release/wintun.dll -DestinationPath mypubdir4/tun2proxy-${{ matrix.target }}.zip + powershell Compress-Archive -Path target/${{ matrix.target }}/release/tun2proxy-bin.exe, README.md, target/tun2proxy-ffi.h, target/${{ matrix.target }}/release/tun2proxy.dll, target/${{ matrix.target }}/release/wintun.dll -DestinationPath mypubdir4/tun2proxy-${{ matrix.target }}.zip 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 + zip -j mypubdir4/tun2proxy-${{ matrix.target }}.zip target/${{ matrix.target }}/release/tun2proxy-bin 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/ @@ -84,7 +84,7 @@ jobs: zip -r mypubdir4/tun2proxy-apple-xcframework.zip ./tun2proxy.xcframework/ fi elif [[ "${{ matrix.host_os }}" == "ubuntu-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.so + zip -j mypubdir4/tun2proxy-${{ matrix.target }}.zip target/${{ matrix.target }}/release/tun2proxy-bin README.md target/tun2proxy-ffi.h target/${{ matrix.target }}/release/libtun2proxy.so if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]]; then ./build-android.sh cp ./tun2proxy-android-libs.zip ./mypubdir4/ diff --git a/Cargo.toml b/Cargo.toml index 133d915..d26e7d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ windows-service = "0.7" serde_json = "1" [[bin]] -name = "tun2proxy" +name = "tun2proxy-bin" path = "src/bin/main.rs" [profile.release] diff --git a/Dockerfile b/Dockerfile index 6680cde..e6ad592 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,6 @@ FROM ubuntu:latest RUN apt update && apt install -y iproute2 && apt clean all -COPY --from=builder /worker/target/release/tun2proxy /usr/bin/tun2proxy +COPY --from=builder /worker/target/release/tun2proxy-bin /usr/bin/tun2proxy-bin -ENTRYPOINT ["/usr/bin/tun2proxy", "--setup"] +ENTRYPOINT ["/usr/bin/tun2proxy-bin", "--setup"] diff --git a/README.md b/README.md index 777f22d..a236c7f 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ A tunnel interface for HTTP and SOCKS proxies on Linux, Android, macOS, iOS and ![tun2proxy](https://docs.rs/tun2proxy/badge.svg) [![Documentation](https://img.shields.io/badge/docs-release-brightgreen.svg?style=flat)](https://docs.rs/tun2proxy) [![Download](https://img.shields.io/crates/d/tun2proxy.svg)](https://crates.io/crates/tun2proxy) -[![License](https://img.shields.io/crates/l/tun2proxy.svg?style=flat)](https://github.com/blechschmidt/tun2proxy/blob/master/LICENSE) +[![License](https://img.shields.io/crates/l/tun2proxy.svg?style=flat)](https://github.com/tun2proxy/tun2proxy/blob/master/LICENSE) -> Additional information can be found in the [wiki](https://github.com/blechschmidt/tun2proxy/wiki) +> Additional information can be found in the [wiki](https://github.com/tun2proxy/tun2proxy/wiki) ## Features - HTTP proxy support (unauthenticated, basic and digest auth) @@ -15,7 +15,7 @@ A tunnel interface for HTTP and SOCKS proxies on Linux, Android, macOS, iOS and - SOCKS4a and SOCKS5h support (through the virtual DNS feature) - Minimal configuration setup for routing all traffic - IPv4 and IPv6 support -- GFW evasion mechanism for certain use cases (see [issue #35](https://github.com/blechschmidt/tun2proxy/issues/35)) +- GFW evasion mechanism for certain use cases (see [issue #35](https://github.com/tun2proxy/tun2proxy/issues/35)) - SOCKS5 UDP support - Native support for proxying DNS over TCP @@ -35,7 +35,7 @@ To build an XCFramework for macOS and iOS, run the following: ### Install from binary -Download the binary from [releases](https://github.com/blechschmidt/tun2proxy/releases) and put it in your `PATH`. +Download the binary from [releases](https://github.com/tun2proxy/tun2proxy/releases) and put it in your `PATH`.
Authenticity Verification @@ -66,7 +66,7 @@ describing the manual setup, except that a bind mount is used to overlay the `/e You would then run the tool as follows: ```bash -sudo ./target/release/tun2proxy --setup --proxy "socks5://1.2.3.4:1080" +sudo ./target/release/tun2proxy-bin --setup --proxy "socks5://1.2.3.4:1080" ``` Apart from SOCKS5, SOCKS4 and HTTP are supported. @@ -105,7 +105,7 @@ sudo ip route add 8000::/1 dev tun0 # Make sure that DNS queries are routed through the tunnel. sudo sh -c "echo nameserver 198.18.0.1 > /etc/resolv.conf" -./target/release/tun2proxy --tun tun0 --proxy "$PROXY_TYPE://$PROXY_IP:$PROXY_PORT" +./target/release/tun2proxy-bin --tun tun0 --proxy "$PROXY_TYPE://$PROXY_IP:$PROXY_PORT" ``` This tool implements a virtual DNS feature that is used by switch `--dns virtual`. When a DNS packet to port 53 is detected, an IP @@ -126,7 +126,7 @@ sudo ip link del tun0 ``` Tunnel interface to proxy. -Usage: tun2proxy [OPTIONS] --proxy [ADMIN_COMMAND]... +Usage: tun2proxy-bin [OPTIONS] --proxy [ADMIN_COMMAND]... Arguments: [ADMIN_COMMAND]... Specify a command to run with root-like capabilities in the new namespace when using `--unshare`. @@ -173,7 +173,7 @@ docker run -d \ --sysctl net.ipv6.conf.default.disable_ipv6=0 \ --cap-add NET_ADMIN \ --name tun2proxy \ - tun2proxy --proxy proto://[username[:password]@]host:port + tun2proxy-bin --proxy proto://[username[:password]@]host:port ``` You can then provide the running container's network to another worker container by sharing the network namespace (like kubernetes sidecar): diff --git a/scripts/iperf3.sh b/scripts/iperf3.sh index f5b388b..e6a0134 100755 --- a/scripts/iperf3.sh +++ b/scripts/iperf3.sh @@ -8,7 +8,7 @@ echo $SCRIPT_DIR netns="test" dante="danted" -tun2proxy="${SCRIPT_DIR}/../target/release/tun2proxy" +tun2proxy="${SCRIPT_DIR}/../target/release/tun2proxy-bin" ip netns add "$netns" @@ -51,4 +51,4 @@ sleep 3 iperf3 -c 10.0.0.4 -P 10 # Clean up -# sudo sh -c "pkill tun2proxy; pkill iperf3; pkill danted; ip link del tun0; ip netns del test" +# sudo sh -c "pkill tun2proxy-bin; pkill iperf3; pkill danted; ip link del tun0; ip netns del test" diff --git a/scripts/linux.sh b/scripts/linux.sh index dc1d805..4cdefaf 100755 --- a/scripts/linux.sh +++ b/scripts/linux.sh @@ -30,7 +30,7 @@ function core_function() { else trap 'echo "" && echo "tun2proxy exited with code: $?" && restore' EXIT local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - local APP_BIN_PATH="${SCRIPT_DIR}/../target/release/tun2proxy" + local APP_BIN_PATH="${SCRIPT_DIR}/../target/release/tun2proxy-bin" "${APP_BIN_PATH}" --tun tun0 --proxy "${PROXY_TYPE}://${PROXY_IP}:${PROXY_PORT}" -v trace fi } diff --git a/scripts/rperf.sh b/scripts/rperf.sh index 00b43a3..db34d25 100755 --- a/scripts/rperf.sh +++ b/scripts/rperf.sh @@ -29,7 +29,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" netns="test" dante="danted" -tun2proxy="${SCRIPT_DIR}/../target/release/tun2proxy" +tun2proxy="${SCRIPT_DIR}/../target/release/tun2proxy-bin" ip netns add "$netns" @@ -80,4 +80,4 @@ sleep 3 rperf -c 10.0.0.4 -v trace -P 1 -u -r # Clean up -# sudo sh -c "pkill tun2proxy; pkill rperf; pkill danted; ip link del tun0; ip netns del test" +# sudo sh -c "pkill tun2proxy-bin; pkill rperf; pkill danted; ip link del tun0; ip netns del test" diff --git a/src/bin/main.rs b/src/bin/main.rs index 8986a8f..4b93d37 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -100,7 +100,7 @@ async fn namespace_proxy_main( log::info!("The tun proxy is running in unprivileged mode. See `namespaces(7)`."); log::info!(""); log::info!("If you need to run a process that relies on root-like capabilities (e.g. `openvpn`)"); - log::info!("Use `tun2proxy --unshare --setup [...] -- openvpn --config [...]`"); + log::info!("Use `tun2proxy-bin --unshare --setup [...] -- openvpn --config [...]`"); log::info!(""); log::info!("To run a new process in the created namespace (e.g. a flatpak app)"); log::info!( diff --git a/tests/iperf/test.sh b/tests/iperf/test.sh index 6332152..0fece2c 100755 --- a/tests/iperf/test.sh +++ b/tests/iperf/test.sh @@ -8,7 +8,7 @@ echo $SCRIPT_DIR netns="test" dante="danted" -tun2proxy="${SCRIPT_DIR}/../../target/release/tun2proxy" +tun2proxy="${SCRIPT_DIR}/../../target/release/tun2proxy-bin" ip netns add "$netns" @@ -47,4 +47,4 @@ iperf3 -c 10.0.0.4 iperf3 -c 10.0.0.4 -R -P 10 # Clean up -# sudo sh -c "pkill tun2proxy; pkill iperf3; pkill danted; ip link del tun0; ip netns del test" +# sudo sh -c "pkill tun2proxy-bin; pkill iperf3; pkill danted; ip link del tun0; ip netns del test" diff --git a/tests/tests.py b/tests/tests.py index 0ec0891..a2f4597 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -29,8 +29,8 @@ def get_ip(version=None): def get_tool_path(): - default = glob.glob(os.path.join(os.path.dirname(__file__), '..', 'target', '*', 'tun2proxy')) - default = default[0] if len(default) > 0 else 'tun2proxy' + default = glob.glob(os.path.join(os.path.dirname(__file__), '..', 'target', '*', 'tun2proxy-bin')) + default = default[0] if len(default) > 0 else 'tun2proxy-bin' return os.environ.get('TOOL_PATH', default)