├── README.md ├── byedpi ├── patches │ ├── series │ └── makefile.patch ├── Makefile └── files │ ├── byedpi.config │ └── byedpi.init └── .github └── workflows └── build.yml /README.md: -------------------------------------------------------------------------------- 1 | # ByeDPI-OpenWrt -------------------------------------------------------------------------------- /byedpi/patches/series: -------------------------------------------------------------------------------- 1 | makefile.patch 2 | -------------------------------------------------------------------------------- /byedpi/patches/makefile.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile b/Makefile 2 | index 1104290..eacfcb6 100644 3 | --- a/Makefile 4 | +++ b/Makefile 5 | @@ -1,6 +1,6 @@ 6 | TARGET = ciadpi 7 | 8 | -CPPFLAGS = -D_DEFAULT_SOURCE 9 | +CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=199309L 10 | CFLAGS += -I. -std=c99 -O2 -Wall -Wno-unused -Wextra -Wno-unused-parameter -pedantic 11 | WIN_LDFLAGS = -lws2_32 -lmswsock 12 | 13 | -------------------------------------------------------------------------------- /byedpi/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=byedpi 4 | PKG_VERSION:=@VERSION@ 5 | PKG_RELEASE:=1 6 | 7 | PKG_SOURCE:=v$(PKG_VERSION).tar.gz 8 | PKG_SOURCE_URL:=https://github.com/hufrea/byedpi/archive/ 9 | PKG_HASH:=skip 10 | 11 | PKG_LICENSE:=MIT 12 | PKG_LICENSE_FILES:=LICENSE 13 | 14 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 15 | PKG_BUILD_PARALLEL:=1 16 | 17 | include $(INCLUDE_DIR)/package.mk 18 | 19 | define Package/byedpi 20 | SECTION:=net 21 | CATEGORY:=Network 22 | TITLE:=ByeDPI 23 | URL:=https://github.com/hufrea/byedpi 24 | endef 25 | 26 | define Package/byedpi/description 27 | Local SOCKS proxy server to bypass DPI (Deep Packet Inspection) 28 | endef 29 | 30 | define Package/byedpi/install 31 | $(INSTALL_DIR) $(1)/usr/bin 32 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ciadpi $(1)/usr/bin 33 | 34 | $(INSTALL_DIR) $(1)/etc/init.d 35 | $(INSTALL_BIN) ./files/byedpi.init $(1)/etc/init.d/byedpi 36 | 37 | $(INSTALL_DIR) $(1)/etc/config 38 | $(INSTALL_CONF) ./files/byedpi.config $(1)/etc/config/byedpi 39 | endef 40 | 41 | $(eval $(call BuildPackage,byedpi)) 42 | -------------------------------------------------------------------------------- /byedpi/files/byedpi.config: -------------------------------------------------------------------------------- 1 | 2 | config byedpi 'main' 3 | option enabled 1 4 | 5 | # if set, all other uci settings are ignored 6 | option cmd_opts '--split 1 --disorder 3+s --mod-http=h,d --auto=torst --tlsrec 1+s' 7 | 8 | # option ip '0.0.0.0' 9 | # option port '1080' 10 | # option pidfile '' 11 | # option transparent 0 12 | # option max_conn '512' 13 | # option no_domain 0 14 | # option no_udp 0 15 | # option conn_ip '::' 16 | # option buf_size '16384' 17 | # option debug '0' 18 | # option def_ttl '' 19 | # option tfo 0 20 | # option auto '' 21 | # option auto-mode '' 22 | # option cache_ttl '100800' 23 | # option timeout '' 24 | # option proto '' 25 | # option hosts '' 26 | # option ipset '' 27 | # option pf '' 28 | # option round '' 29 | # list split '' 30 | # option disorder '' 31 | # option oob '' 32 | # option disoob '' 33 | # option fake '' 34 | # option md5sig 0 35 | # list fake_sni '' 36 | # option ttl '8' 37 | # option fake_offset '' 38 | # option fake_data '' 39 | # option fake_tls_mod '' 40 | # option oob_data '' 41 | # option mod_http '' 42 | # list tlsrec '' 43 | # option udp_fake '0' 44 | # option drop_sack '' 45 | -------------------------------------------------------------------------------- /byedpi/files/byedpi.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # shellcheck disable=SC3043,SC2034 3 | 4 | START=95 5 | USE_PROCD=1 6 | #PROCD_DEBUG=1 7 | PROG=/usr/bin/ciadpi 8 | OPTS="" 9 | 10 | readonly packageName='byedpi' 11 | 12 | boot() { 13 | # Wait for the loopback interface to be ready 14 | ubus -t 30 wait_for network.interface network.loopback 2>/dev/null 15 | rc_procd start_service 16 | } 17 | 18 | xappend() { 19 | local name="$2" value="$1" 20 | OPTS="$OPTS --${name//_/-} ${value//'/\\'}" 21 | } 22 | 23 | append_opts() { 24 | local name value cfg="$1"; shift 25 | for name in $*; do 26 | config_get value "$cfg" "$name" 27 | [ -n "$value" ] && xappend "$value" "$name" 28 | done 29 | } 30 | 31 | append_opts_list() { 32 | local name cfg="$1"; shift 33 | for name in $*; do 34 | config_list_foreach "$cfg" "$name" xappend "$name" 35 | done 36 | } 37 | 38 | append_opts_boolean() { 39 | local name value cfg="$1"; shift 40 | for name in $*; do 41 | config_get_bool value "$cfg" "$name" 0 42 | [ $value -gt 0 ] && xappend '' $name 43 | done 44 | } 45 | 46 | section_enabled() { 47 | config_get_bool enabled "$1" 'enabled' 0 48 | [ $enabled -gt 0 ] 49 | } 50 | 51 | start_instance() { 52 | local cfg="$1" 53 | local cmd_opts 54 | 55 | section_enabled "$cfg" || return 56 | 57 | OPTS="" 58 | 59 | config_get cmd_opts main cmd_opts 60 | if [ -n "$cmd_opts" ]; then 61 | OPTS="$cmd_opts" 62 | else 63 | append_opts "$cfg" ip port pidfile max_conn conn_ip buf_size debug def_ttl auto auto_mode cache_ttl timeout proto \ 64 | hosts ipset pf round disorder oob disoob fake ttl fake_offset fake_data fake_tls_mod oob_data mod_http udp_fake 65 | append_opts_list "$cfg" split fake_sni tlsrec 66 | append_opts_boolean "$cfg" transparent no_domain no_udp tfo md5sig drop_sack 67 | fi 68 | 69 | procd_open_instance 70 | procd_set_param command $PROG $OPTS 71 | procd_set_param stdout 1 72 | procd_set_param stderr 1 73 | procd_set_param user nobody 74 | procd_set_param respawn 75 | procd_close_instance 76 | } 77 | 78 | start_service() { 79 | config_load "${packageName}" 80 | config_foreach start_instance "${packageName}" 81 | } 82 | 83 | service_triggers() { 84 | procd_add_config_trigger "config.change" "${packageName}" /etc/init.d/${packageName} reload 85 | } 86 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | outputs: 10 | tag: ${{ steps.prepare.outputs.tag }} 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | branch: 15 | - openwrt-19.07 16 | - openwrt-21.02 17 | - openwrt-22.03 18 | - openwrt-23.05 19 | - openwrt-24.10 20 | arch: 21 | - aarch64_cortex-a53 22 | - aarch64_cortex-a72 23 | - aarch64_generic 24 | - arm_arm1176jzf-s_vfp 25 | - arm_arm926ej-s 26 | - arm_cortex-a15_neon-vfpv4 27 | - arm_cortex-a5_vfpv4 28 | - arm_cortex-a7 29 | - arm_cortex-a7_neon-vfpv4 30 | - arm_cortex-a7_vfpv4 31 | - arm_cortex-a8_vfpv3 32 | - arm_cortex-a9 33 | - arm_cortex-a9_neon 34 | - arm_cortex-a9_vfpv3-d16 35 | - arm_fa526 36 | - arm_mpcore 37 | - arm_xscale 38 | - mips64_octeonplus 39 | - mips_24kc 40 | - mips_4kec 41 | - mips_mips32 42 | - mipsel_24kc 43 | - mipsel_24kc_24kf 44 | - mipsel_74kc 45 | - mipsel_mips32 46 | - x86_64 47 | exclude: 48 | - branch: openwrt-19.07 49 | arch: arm_cortex-a7 50 | - branch: openwrt-19.07 51 | arch: arm_cortex-a7_vfpv4 52 | - branch: openwrt-19.07 53 | arch: mips_4kec 54 | - branch: openwrt-21.02 55 | arch: arm_cortex-a7_vfpv4 56 | - branch: openwrt-24.10 57 | arch: arm_mpcore 58 | include: 59 | - branch: openwrt-24.10 60 | arch: aarch64_cortex-a76 61 | # - branch: SNAPSHOT 62 | # arch: x86_64 63 | container: 64 | image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }} 65 | options: --user root 66 | defaults: { run: { shell: bash } } 67 | steps: 68 | - name: Checkout 69 | uses: actions/checkout@v4 70 | 71 | - name: Setup SDK 72 | if: matrix.branch == 'openwrt-23.05' || matrix.branch == 'openwrt-24.10' || matrix.branch == 'SNAPSHOT' 73 | working-directory: /builder 74 | run: HOME=/builder ./setup.sh 75 | 76 | - name: Prepare build 77 | id: prepare 78 | env: 79 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 80 | REPO: 'hufrea/byedpi' 81 | run : | 82 | TAG=$(wget -qO- --header="Authorization: token $GH_TOKEN" http://api.github.com/repos/$REPO/releases/latest | grep -Po '"tag_name": "\K.+?(?=")') 83 | sed "s|@VERSION@|${TAG#v}|" -i byedpi/Makefile 84 | echo "tag=$TAG" >> $GITHUB_OUTPUT 85 | 86 | - name: Build package 87 | id: build 88 | working-directory: ${{ matrix.branch == 'openwrt-19.07' && '/home/build/openwrt' || '/builder' }} 89 | env: 90 | ARCH: ${{ matrix.arch }} 91 | BRANCH: ${{ matrix.branch }} 92 | SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }} 93 | run: | 94 | echo "src-link byedpi $GITHUB_WORKSPACE" >> feeds.conf 95 | ./scripts/feeds update byedpi 96 | ./scripts/feeds install -a -p byedpi 97 | make defconfig 98 | make package/byedpi/compile V=s -j$(nproc) BUILD_LOG=1 99 | echo "$SIGN_KEY" | base64 -d > key-build 100 | make package/index 101 | tar -C ./bin/packages/*/byedpi -cvf $GITHUB_WORKSPACE/ipk-$BRANCH-$ARCH.tar --transform "s|^\./|${BRANCH/openwrt-}/$ARCH/|" --show-transformed-names . 102 | 103 | - name: Compress build logs 104 | if: always() 105 | env: 106 | ARCH: ${{ matrix.arch }} 107 | BRANCH: ${{ matrix.branch }} 108 | LOGS_DIR: ${{ matrix.branch == 'openwrt-19.07' && '/home/build/openwrt/logs' || '/builder/logs' }} 109 | run: | 110 | tar -cJvf logs-$BRANCH-$ARCH.tar.xz $LOGS_DIR 111 | 112 | - name: Upload packages 113 | if: steps.build.outcome == 'success' 114 | uses: actions/upload-artifact@v4 115 | with: 116 | name: ipk-${{ matrix.branch }}-${{ matrix.arch }} 117 | path: ipk-${{ matrix.branch }}-${{ matrix.arch }}.tar 118 | if-no-files-found: error 119 | 120 | - name: Upload build logs 121 | if: always() 122 | uses: actions/upload-artifact@v4 123 | with: 124 | name: logs-${{ matrix.branch }}-${{ matrix.arch }} 125 | path: logs-*.tar.xz 126 | 127 | gh-pages: 128 | needs: build 129 | permissions: 130 | contents: write 131 | runs-on: ubuntu-latest 132 | steps: 133 | - name: Download artifacts 134 | uses: actions/download-artifact@v4 135 | with: 136 | pattern: ipk-* 137 | 138 | - name: Prepare files 139 | run: | 140 | mkdir public 141 | find . -name 'ipk-*.tar' -exec tar -C ./public -xvf {} \; 142 | cat <> public/public.key 143 | untrusted comment: ByeDPI OpenWrt repo 144 | RWRT/Cfg5ReIbqWME8QTUQ1FKxp8FTr9M9g1vDsL8uIdRyP5TTNAk4QA 145 | EOF 146 | 147 | - name: Deploy to GH pages 148 | uses: peaceiris/actions-gh-pages@v4 149 | with: 150 | github_token: ${{ secrets.GITHUB_TOKEN }} 151 | user_name: 'github-actions[bot]' 152 | user_email: 'github-actions[bot]@users.noreply.github.com' 153 | full_commit_message: 'ByeDPI ${{ needs.build.outputs.tag }}' 154 | force_orphan: true 155 | 156 | release: 157 | needs: [ build, gh-pages ] 158 | permissions: 159 | contents: write 160 | runs-on: ubuntu-latest 161 | strategy: 162 | max-parallel: 1 163 | matrix: 164 | branch: 165 | - '19.07' 166 | - '21.02' 167 | - '22.03' 168 | - '23.05' 169 | - '24.10' 170 | steps: 171 | - name: Download artifacts 172 | uses: actions/download-artifact@v4 173 | with: 174 | pattern: ipk-* 175 | 176 | - name: Prepare files 177 | env: 178 | BRANCH: ${{ matrix.branch }} 179 | run: | 180 | find . -name "ipk-openwrt-$BRANCH-*.tar" -exec tar -xvf {} --wildcards '*.ipk' \; 181 | 182 | - name: Upload release assets 183 | uses: softprops/action-gh-release@v2 184 | with: 185 | fail_on_unmatched_files: true 186 | tag_name: ${{ needs.build.outputs.tag }}-${{ matrix.branch }} 187 | name: ${{ needs.build.outputs.tag }} for OpenWrt ${{ matrix.branch }} 188 | target_commitish: gh-pages 189 | body: | 190 | ### ByeDPI ${{ needs.build.outputs.tag }} for OpenWrt ${{ matrix.branch }} 191 | 192 | ----- 193 | Check the package architecture of your device using the command: 194 | ``` 195 | # awk -F\' '/DISTRIB_ARCH/ {print $2}' /etc/openwrt_release 196 | ``` 197 | files: ./**/*.ipk 198 | --------------------------------------------------------------------------------