diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c5a92fe..d0b1d0b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,31 +31,31 @@ jobs: - name: Install NDK run: | echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \ - --channel=3 \ - --install "ndk;29.0.13113456" - echo "NDK_HOME=$ANDROID_HOME/ndk/29.0.13113456" >> $GITHUB_ENV + --channel=0 \ + --install "ndk;28.2.13676358" + echo "NDK_HOME=$ANDROID_HOME/ndk/28.2.13676358" >> $GITHUB_ENV sed -i '10i\ \ - ndkVersion = "29.0.13113456"' ${{ github.workspace }}/V2rayNG/app/build.gradle.kts + ndkVersion = "28.2.13676358"' ${{ github.workspace }}/V2rayNG/app/build.gradle.kts - name: Restore cached libtun2socks id: cache-libtun2socks-restore uses: actions/cache/restore@v4 with: path: ${{ github.workspace }}/libs - key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }} + key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/hev-socks5-tunnel/HEAD') }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }} - name: Build libtun2socks if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' run: | bash compile-tun2socks.sh - + - name: Save libtun2socks if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: ${{ github.workspace }}/libs - key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }} + key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/hev-socks5-tunnel/HEAD') }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }} - name: Copy libtun2socks run: | diff --git a/.gitmodules b/.gitmodules index 2bdafca3..6f9421b3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ [submodule "libancillary"] path = libancillary url = https://github.com/shadowsocks/libancillary +[submodule "hev-socks5-tunnel"] + path = hev-socks5-tunnel + url = https://github.com/heiher/hev-socks5-tunnel + branch = master diff --git a/compile-tun2socks.sh b/compile-tun2socks.sh index c0db6218..83291ecc 100644 --- a/compile-tun2socks.sh +++ b/compile-tun2socks.sh @@ -30,3 +30,29 @@ $NDK_HOME/ndk-build \ cp -r $TMPDIR/libs $__dir/ popd rm -rf $TMPDIR + +#build hev-socks5-tunnel +HEVTUN_TMP=$(mktemp -d) +trap 'rm -rf "$HEVTUN_TMP"' EXIT + +mkdir -p "$HEVTUN_TMP/jni" +pushd "$HEVTUN_TMP" + +echo 'include $(call all-subdir-makefiles)' > jni/Android.mk + +ln -s "$__dir/hev-socks5-tunnel" jni/hev-socks5-tunnel + +"$NDK_HOME/ndk-build" \ + NDK_PROJECT_PATH=. \ + APP_BUILD_SCRIPT=jni/Android.mk \ + "APP_ABI=armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-21 \ + NDK_LIBS_OUT="$HEVTUN_TMP/libs" \ + NDK_OUT="$HEVTUN_TMP/tmp" \ + "APP_CFLAGS=O3 -DPKGNAME=com/v2ray/ang/service" \ + "APP_LDFLAGS=-WI,--build-id=none -WI,--hash-style=gnu" \ + +cp -r "$HEVTUN_TMP/libs/"* "$__dir/libs/" +popd + +rm -rf "$HEVTUN_TMP" \ No newline at end of file diff --git a/hev-socks5-tunnel b/hev-socks5-tunnel new file mode 160000 index 00000000..f2cbad55 --- /dev/null +++ b/hev-socks5-tunnel @@ -0,0 +1 @@ +Subproject commit f2cbad55b6f1c7b600a46aff407da558aa0acec2