From 4f9ab69b37f1ed5dfe8dace57ca05499f287094f Mon Sep 17 00:00:00 2001 From: spvkgn Date: Thu, 8 Aug 2024 19:53:42 +0500 Subject: [PATCH 1/5] OpenWrt workflow --- .editorconfig | 4 + .github/workflows/build-openwrt.yml | 116 ++++++++++++++++++++++++++++ .gitignore | 2 + 3 files changed, 122 insertions(+) create mode 100644 .github/workflows/build-openwrt.yml diff --git a/.editorconfig b/.editorconfig index 8126eab..8df5edd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,3 +4,7 @@ root = true indent_style = tab indent_size = 8 tab_width = 8 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml new file mode 100644 index 0000000..2229ed4 --- /dev/null +++ b/.github/workflows/build-openwrt.yml @@ -0,0 +1,116 @@ +name: build-openwrt + +on: + push: + # tags: + # - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.build.outputs.version }} + strategy: + matrix: + branch: [openwrt-23.05] + arch: + - aarch64_cortex-a53 + - aarch64_cortex-a72 + - aarch64_generic + - arm_arm1176jzf-s_vfp + - arm_arm926ej-s + - arm_cortex-a15_neon-vfpv4 + - arm_cortex-a5_vfpv4 + - arm_cortex-a7 + - arm_cortex-a7_neon-vfpv4 + - arm_cortex-a7_vfpv4 + - arm_cortex-a8_vfpv3 + - arm_cortex-a9 + - arm_cortex-a9_neon + - arm_cortex-a9_vfpv3-d16 + - arm_fa526 + - arm_mpcore + - arm_xscale + - mips64_octeonplus + - mips_24kc + - mips_4kec + - mips_mips32 + - mipsel_24kc + - mipsel_24kc_24kf + - mipsel_74kc + - mipsel_mips32 + - x86_64 + container: + image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }} + options: --user root + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: 'openwrt' + + - name: Build packages + id: build + working-directory: /builder + env: + ARCH: ${{ matrix.arch }} + BRANCH: ${{ matrix.branch }} + shell: bash + run: | + cp -va $GITHUB_WORKSPACE/youtubeUnblock package + VERSION=$(grep -Po 'PKG_VERSION:=\K.*' package/youtubeUnblock/Makefile) + echo "version=$VERSION" >> $GITHUB_OUTPUT + sed -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' \ + -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' -i feeds.conf.default + ./scripts/feeds update base packages + ./scripts/feeds install -a + make defconfig + make package/youtubeUnblock/compile V=s -j$(nproc) BUILD_LOG=1 + + - name: Compress build logs + if: always() + env: + ARCH: ${{ matrix.arch }} + BRANCH: ${{ matrix.branch }} + run: | + tar -cJvf logs-$BRANCH-$ARCH.tar.xz /builder/logs + + - name: Upload packages + if: steps.build.outcome == 'success' + uses: actions/upload-artifact@v4 + with: + name: ipk-${{ matrix.branch }}-${{ matrix.arch }} + path: /builder/**/youtubeUnblock*.ipk + if-no-files-found: error + + - name: Upload build logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: logs-${{ matrix.branch }}-${{ matrix.arch }} + path: ./**/logs-${{ matrix.branch }}-${{ matrix.arch }}.tar.xz + + release: + needs: build + permissions: + contents: write + runs-on: ubuntu-latest + strategy: + matrix: + branch: ['23.05'] + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: ipk-* + + - name: Upload release assets + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + prerelease: false + tag: v${{ needs.build.outputs.version }}-owrt${{ matrix.branch }} + name: v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} + body: | + youtubeUnblock v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} + artifacts: ./**/*.ipk diff --git a/.gitignore b/.gitignore index f865d01..82104c4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ modules.order Module.symvers *.so *.ko + +!/.github From 7b9e7b773b08c9c77ea1f7d5a607d4af6e5696c3 Mon Sep 17 00:00:00 2001 From: spvkgn Date: Fri, 9 Aug 2024 20:22:20 +0500 Subject: [PATCH 2/5] remove release job --- .github/workflows/build-openwrt.yml | 43 ++++------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml index 2229ed4..a18b4cf 100644 --- a/.github/workflows/build-openwrt.yml +++ b/.github/workflows/build-openwrt.yml @@ -1,9 +1,7 @@ name: build-openwrt on: - push: - # tags: - # - 'v*' + workflow_dispatch: jobs: build: @@ -52,9 +50,6 @@ jobs: - name: Build packages id: build working-directory: /builder - env: - ARCH: ${{ matrix.arch }} - BRANCH: ${{ matrix.branch }} shell: bash run: | cp -va $GITHUB_WORKSPACE/youtubeUnblock package @@ -62,8 +57,6 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT sed -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' \ -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' -i feeds.conf.default - ./scripts/feeds update base packages - ./scripts/feeds install -a make defconfig make package/youtubeUnblock/compile V=s -j$(nproc) BUILD_LOG=1 @@ -71,15 +64,14 @@ jobs: if: always() env: ARCH: ${{ matrix.arch }} - BRANCH: ${{ matrix.branch }} run: | - tar -cJvf logs-$BRANCH-$ARCH.tar.xz /builder/logs + tar -cJvf logs-$ARCH.tar.xz /builder/logs - name: Upload packages if: steps.build.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: ipk-${{ matrix.branch }}-${{ matrix.arch }} + name: ipk-${{ matrix.arch }} path: /builder/**/youtubeUnblock*.ipk if-no-files-found: error @@ -87,30 +79,5 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: logs-${{ matrix.branch }}-${{ matrix.arch }} - path: ./**/logs-${{ matrix.branch }}-${{ matrix.arch }}.tar.xz - - release: - needs: build - permissions: - contents: write - runs-on: ubuntu-latest - strategy: - matrix: - branch: ['23.05'] - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: ipk-* - - - name: Upload release assets - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - prerelease: false - tag: v${{ needs.build.outputs.version }}-owrt${{ matrix.branch }} - name: v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} - body: | - youtubeUnblock v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} - artifacts: ./**/*.ipk + name: logs-${{ matrix.arch }} + path: ./**/logs-*.tar.xz From 34345b127b773b9efd8f9ab4b748cd3e72be3429 Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Sat, 10 Aug 2024 01:08:00 +0300 Subject: [PATCH 3/5] Update workflow --- .github/workflows/build-openwrt.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml index a18b4cf..90007c1 100644 --- a/.github/workflows/build-openwrt.yml +++ b/.github/workflows/build-openwrt.yml @@ -1,7 +1,7 @@ name: build-openwrt on: - workflow_dispatch: + - push jobs: build: @@ -10,7 +10,8 @@ jobs: version: ${{ steps.build.outputs.version }} strategy: matrix: - branch: [openwrt-23.05] + branch: + - openwrt-23.05 arch: - aarch64_cortex-a53 - aarch64_cortex-a72 @@ -37,6 +38,7 @@ jobs: - mipsel_24kc_24kf - mipsel_74kc - mipsel_mips32 + - ramips-mt76x8 - x86_64 container: image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }} @@ -46,19 +48,25 @@ jobs: uses: actions/checkout@v4 with: ref: 'openwrt' + + - name: Prepare workflow + shell: bash + run: | + sed -i 's/PKG_REV:=.*$/PKG_REV:=${{ github.sha }}/;s/PKG_VERSION:=.*$/PKG_VERSION:=$(date %Y%m%d)/' youtubeUnblock/Makefile + - name: Build packages id: build working-directory: /builder shell: bash run: | - cp -va $GITHUB_WORKSPACE/youtubeUnblock package - VERSION=$(grep -Po 'PKG_VERSION:=\K.*' package/youtubeUnblock/Makefile) - echo "version=$VERSION" >> $GITHUB_OUTPUT - sed -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' \ - -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' -i feeds.conf.default - make defconfig - make package/youtubeUnblock/compile V=s -j$(nproc) BUILD_LOG=1 + echo "src-link youtubeUnblock $GITHUB_WORKSPACE" >> feeds.conf + su - buildbot -c 'cat feeds.conf' + su - buildbot -c './scripts/feeds update youtubeUnblock' + su - buildbot -c './scripts/feeds install -a -p youtubeUnblock' + su - buildbot -c 'make defconfig' + su - buildbot -c 'make package/youtubeUnblock/compile V=s BUILD_LOG=1' + - name: Compress build logs if: always() From dc03bee64bccee2a0b7b8876e0fbb800f16b441c Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Sat, 10 Aug 2024 02:21:18 +0300 Subject: [PATCH 4/5] Delete build logs, update names --- .github/workflows/build-openwrt.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml index 90007c1..2e524f6 100644 --- a/.github/workflows/build-openwrt.yml +++ b/.github/workflows/build-openwrt.yml @@ -1,4 +1,4 @@ -name: build-openwrt +name: OpenWRT Workflow on: - push @@ -48,7 +48,6 @@ jobs: uses: actions/checkout@v4 with: ref: 'openwrt' - - name: Prepare workflow shell: bash @@ -67,25 +66,10 @@ jobs: su - buildbot -c 'make defconfig' su - buildbot -c 'make package/youtubeUnblock/compile V=s BUILD_LOG=1' - - - name: Compress build logs - if: always() - env: - ARCH: ${{ matrix.arch }} - run: | - tar -cJvf logs-$ARCH.tar.xz /builder/logs - - name: Upload packages if: steps.build.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: ipk-${{ matrix.arch }} + name: ${{ matrix.arch }}-${{ matrix.branch }} path: /builder/**/youtubeUnblock*.ipk if-no-files-found: error - - - name: Upload build logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: logs-${{ matrix.arch }} - path: ./**/logs-*.tar.xz From da10542edccbda3bdd10a388c20c7ede6cf0b776 Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Sat, 10 Aug 2024 02:31:11 +0300 Subject: [PATCH 5/5] Update OpenWRT Workflow --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e57e5f5..34aec4e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # youtubeUnblock -Bypasses Googlevideo detection systems that relies on SNI. The package is for Linux only. The package is fully compatible with routers running OpenWRT. To learn how to build the package on OpenWRT, consult [this chapter](https://github.com/Waujito/youtubeUnblock?tab=readme-ov-file#openwrt-case). +Bypasses Googlevideo detection systems that relies on SNI. The package is for Linux only. The package is fully compatible with routers running OpenWRT. The binaries are available under [Github Actions](https://github.com/Waujito/youtubeUnblock/actions). To learn how to build and configure the package on OpenWRT, consult [this chapter](https://github.com/Waujito/youtubeUnblock?tab=readme-ov-file#openwrt-case). For Windows use [GoodbyeDPI from ValdikSS](https://github.com/ValdikSS/GoodbyeDPI) (you can find how to use it for YouTube [here](https://github.com/ValdikSS/GoodbyeDPI/issues/378)) The same behavior is also implemented in [zapret package for linux](https://github.com/bol-van/zapret). @@ -71,13 +71,17 @@ You can build under openwrt with two options: first - through the SDK, which is ### Building OpenWRT .ipk package OpenWRT provides a high-level SDK for the package builds. -First step is to download or compile OpenWRT SDK for your specific platform. The SDK can be compiled according to [this tutorial](https://openwrt.org/docs/guide-developer/toolchain/using_the_sdk). Beside of raw source code of SDK, OpenWRT also offers precompiled SDKs for your router. You can find it on the router page. For example, I have ramips/mt76x8 based router so for me the sdk is on https://downloads.openwrt.org/releases/23.05.3/targets/ramips/mt76x8/ and called `openwrt-sdk-23.05.3-ramips-mt76x8_gcc-12.3.0_musl.Linux-x86_64`. You will need to [install sdk requirements on your system](https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem) If you have any problems, use docker ubuntu:24.04 image. Make sure to be a non-root user since some makesystem fails with it. Next, untar the SDK and cd into it. Do `echo "src-git youtubeUnblock https://github.com/Waujito/youtubeUnblock.git;openwrt" >> feeds.conf`, `./scripts/feeds update youtubeUnblock`, `./scripts/feeds install -a -p youtubeUnblock`, `make package/youtubeUnblock/compile`. Now the packet is built and you can import it to the router. Find it in `bin/packages//youtubeUnblock/youtubeUnblock-.ipk`. Go to your router interface and put it in via System-Software-install_package. Now the package is on the router. Goto System-Startup, restart firewall and start youtubeUnblock. You are done! +First step is to download or compile OpenWRT SDK for your specific platform. The SDK can be compiled according to [this tutorial](https://openwrt.org/docs/guide-developer/toolchain/using_the_sdk). Beside of raw source code of SDK, OpenWRT also offers precompiled SDKs for your router. You can find it on the router page. For example, I have ramips/mt76x8 based router so for me the sdk is on https://downloads.openwrt.org/releases/23.05.3/targets/ramips/mt76x8/ and called `openwrt-sdk-23.05.3-ramips-mt76x8_gcc-12.3.0_musl.Linux-x86_64`. You will need to [install sdk requirements on your system](https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem) If you have any problems, use docker ubuntu:24.04 image. Make sure to be a non-root user since some makesystem fails with it. Next, untar the SDK and cd into it. Do `echo "src-git youtubeUnblock https://github.com/Waujito/youtubeUnblock.git;openwrt" >> feeds.conf`, `./scripts/feeds update youtubeUnblock`, `./scripts/feeds install -a -p youtubeUnblock`, `make package/youtubeUnblock/compile`. Now the packet is built and you can import it to the router. Find it in `bin/packages//youtubeUnblock/youtubeUnblock-.ipk`. ### Building with toolchain The precompiled toolchain located near the SDK. For me it is called `openwrt-toolchain-23.05.3-ramips-mt76x8_gcc-12.3.0_musl.Linux-x86_64.tar.xz`. When you download the toolchain, untar it somewhere. Now we are ready for compilation. My cross gcc asked me to create a staging dir for it and pass it as an environment variable. Also you should notice toolsuite packages and replace my make command with yours. ```STAGING_DIR=temp make CC=/usr/bin/mipsel-openwrt-linux-gcc LD=/usr/bin/mipsel-openwrt-linux-ld AR=/usr/bin/mipsel-openwrt-linux-ar OBJDUMP=/usr/bin/mipsel-openwrt-linux-objdump NM=/usr/bin/mipsel-openwrt-linux-nm STRIP=/usr/bin/mipsel-openwrt-linux-strip CROSS_COMPILE_PLATFORM=mipsel-buildroot-linux-gnu```. Take a look at `CROSS_COMPILE_PLATFORM` It is required by autotools but I think it is not necessary. Anyways I put `mipsel-buildroot-linux-gnu` in here. For your model may be an [automake cross-compile manual](https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html) will be helpful. When compilation is done, the binary file will be in build directory. Copy it to your router. Note that an ssh access is likely to be required to proceed. sshfs don't work on my model so I injected the application to the router via Software Upload Package page. It has given me an error, but also a `/tmp/upload.ipk` file which I copied in root directory, `chmod +x`-ed and run. ### Configuration -If you compiled the package via the SDK everything is preinstalled. But if you got any issues (suitable for routers with iptables instead of nftables), ssh into the router and check up everything manually. +When you got the packet you should install it. Go to your router interface and put it in via System-Software-install_package. Now the package is on the router. Goto System-Startup, restart firewall and start youtubeUnblock. You are done! + +Make sure the required packets are installed: kmod-nft-queue if you're using nftables or kmod-ipt-nfqueue if you're using iptables. + +If you compiled the package via the SDK or downloaded the binary everything is preinstalled. But if you got any issues (suitable for routers with iptables instead of nftables), ssh into the router and check up everything manually. For iptables: install a normal iptables user-space app: `xtables-legacy iptables-zz-legacy` and kernel/iptables nfqueue extensions: `iptables-mod-nfqueue kmod-ipt-nfqueue` and add `iptables -t mangle -A FORWARD -p tcp -m tcp --dport 443 -j NFQUEUE --queue-num 537 --queue-bypass` rule.