Skip to content

Commit

Permalink
Update zapret
Browse files Browse the repository at this point in the history
Update SUBNETS in zapret-discord.sh
Enhance zapret-wireguard.sh with improved packet filtering logic
  • Loading branch information
NOFEXtreme committed Jan 2, 2025
1 parent 5117cce commit b0918a6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
44 changes: 33 additions & 11 deletions .github/workflows/zapret-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
tool: i586-unknown-linux-musl
- arch: x86_64
tool: x86_64-unknown-linux-musl
- arch: lexra
tool: mips-linux
dir: rsdk-4.6.4-5281-EB-3.10-0.9.33-m32ub-20141001
env:
CFLAGS: '-march=5281'
LDFLAGS: '-lgcc_eh'
repo: 'bol-van/build'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -62,18 +69,31 @@ jobs:

- name: Set up build tools
env:
REPO: 'spvkgn/musl-cross'
ARCH: ${{ matrix.arch }}
TOOL: ${{ matrix.tool }}
REPO: ${{ matrix.arch == 'lexra' && matrix.repo || 'spvkgn/musl-cross' }}
DIR: ${{ matrix.arch == 'lexra' && matrix.dir || matrix.tool }}
run: |
sudo apt update -qq && sudo apt install -y libcap-dev
if [[ "$ARCH" == lexra ]]; then
sudo dpkg --add-architecture i386
sudo apt update -qq
sudo apt install -y libcap-dev libc6:i386 zlib1g:i386
URL=https://github.com/$REPO/raw/refs/heads/master/$DIR.txz
else
sudo apt update -qq
sudo apt install -y libcap-dev
URL=https://github.com/$REPO/releases/download/latest/$TOOL.tar.xz
fi
mkdir -p $HOME/tools
wget -qO- https://github.com/$REPO/releases/download/latest/$TOOL.tar.xz | tar -C $HOME/tools -xJ || exit 1
[ -d "$HOME/tools/$TOOL/bin" ] && echo "$HOME/tools/$TOOL/bin" >> $GITHUB_PATH
wget -qO- $URL | tar -C $HOME/tools -xJ || exit 1
[[ -d "$HOME/tools/$DIR/bin" ]] && echo "$HOME/tools/$DIR/bin" >> $GITHUB_PATH
- name: Build
env:
ARCH: ${{ matrix.arch }}
TARGET: ${{ matrix.tool }}
CFLAGS: ${{ matrix.env.CFLAGS != '' && matrix.env.CFLAGS || null }}
LDFLAGS: ${{ matrix.env.LDFLAGS != '' && matrix.env.LDFLAGS || null }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DEPS_DIR=$GITHUB_WORKSPACE/deps
Expand All @@ -83,6 +103,7 @@ jobs:
export NM=$TARGET-nm
export STRIP=$TARGET-strip
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
export STAGING_DIR=$RUNNER_TEMP
export CFLAGS="$([ "$ARCH" = "armv7hf" ] && echo "-march=armv7-a -mfpu=neon-vfpv4 -mtune=cortex-a7")"
# netfilter libs
Expand All @@ -93,7 +114,7 @@ jobs:
for i in libmnl libnfnetlink libnetfilter_queue ; do
(
cd $i-*
CFLAGS="-Os -flto=auto" \
CFLAGS="-Os -flto=auto $CFLAGS" \
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
make install -j$(nproc) DESTDIR=$DEPS_DIR
)
Expand All @@ -105,7 +126,7 @@ jobs:
xargs -I{} wget -qO- https://github.com/madler/zlib/archive/refs/tags/{}.tar.gz | tar -xz
(
cd zlib-*
CFLAGS="-Os -flto=auto" \
CFLAGS="-Os -flto=auto $CFLAGS" \
./configure --prefix= --static
make install -j$(nproc) DESTDIR=$DEPS_DIR
)
Expand All @@ -116,7 +137,7 @@ jobs:
install -Dm644 -t $DEPS_DIR/include/sys /usr/include/x86_64-linux-gnu/sys/queue.h /usr/include/sys/capability.h
# zapret
CFLAGS="$CFLAGS -DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -static-libgcc -static -I$DEPS_DIR/include" \
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -static-libgcc -static -I$DEPS_DIR/include $CFLAGS" \
LDFLAGS="-L$DEPS_DIR/lib" \
make -C ${{ env.zapret_dir }} -j$(nproc)
tar -C ${{ env.zapret_dir }}/binaries/my -cJf zapret-linux-$ARCH.tar.xz .
Expand Down Expand Up @@ -219,9 +240,9 @@ jobs:
- name: Build ip2net, mdig
shell: msys2 {0}
run: |
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
mkdir -p ${{ env.zapret_dir }}/output
cd ${{ env.zapret_dir }}
export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}"
mingw32-make -C ip2net win
mingw32-make -C mdig win
cp -a {ip2net/ip2net,mdig/mdig}.exe output/
Expand Down Expand Up @@ -342,7 +363,7 @@ jobs:
wget -qO- https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj
wget -qO- https://www.netfilter.org/pub/libnetfilter_queue/libnetfilter_queue-1.0.5.tar.bz2 | tar -xj
patch -p1 -d libnetfilter_queue-* -i ${{ env.zapret_dir }}/.github/workflows/libnetfilter_queue-android.patch
for i in libmnl libnfnetlink libnetfilter_queue ; do
(
cd $i-*
Expand All @@ -354,7 +375,7 @@ jobs:
done
# zapret
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include"
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include" \
LDFLAGS="-L$DEPS_DIR/lib" \
make -C ${{ env.zapret_dir }} android -j$(nproc)
zip zapret-android-$ABI.zip -j ${{ env.zapret_dir }}/binaries/my/*
Expand Down Expand Up @@ -410,7 +431,7 @@ jobs:
if [[ $dir == *-linux-x86_64 ]]; then
tar -C $dir -czvf $dir/tpws_wsl.tgz tpws
run_upx $dir/*
elif [[ $dir =~ linux ]] && [[ $dir != *-linux-mips64 ]]; then
elif [[ $dir =~ linux ]] && [[ $dir != *-linux-mips64 ]] && [[ $dir != *-linux-lexra ]]; then
run_upx $dir/*
fi
;;
Expand Down Expand Up @@ -444,6 +465,7 @@ jobs:
*-linux-ppc ) run_dir ppc ;;
*-linux-x86 ) run_dir x86 ;;
*-linux-x86_64 ) run_dir x86_64 ;;
*-linux-lexra ) run_dir lexra ;;
*-mac-x64 ) run_dir mac64 ;;
*-win-x86 ) run_dir win32 ;;
*-win-x86_64 ) run_dir win64 ;;
Expand Down
2 changes: 1 addition & 1 deletion core/zapret
Submodule zapret updated 63 files
+3 −3 .github/issue_template.md
+31 −9 .github/workflows/build.yml
+1 −1 blockcheck.sh
+11 −2 common/base.sh
+2 −0 common/custom.sh
+37 −2 common/installer.sh
+22 −8 common/ipt.sh
+55 −0 common/linux_daemons.sh
+2 −0 common/linux_iphelper.sh
+2 −2 common/list.sh
+25 −43 common/nft.sh
+34 −0 docs/changes.txt
+1 −1 docs/quick_start.md
+2 −2 docs/quick_start_windows.md
+8 −4 docs/readme.en.md
+192 −185 docs/readme.md
+3 −2 docs/windows.en.md
+1 −0 docs/windows.md
+0 −0 init.d/custom.d.examples.linux/10-keenetic-udp-fix
+66 −0 init.d/custom.d.examples.linux/20-fw-extra
+2 −2 init.d/custom.d.examples.linux/50-dht4all
+1 −1 init.d/custom.d.examples.linux/50-discord
+89 −0 init.d/custom.d.examples.linux/50-tpws-ipset
+30 −0 init.d/custom.d.examples.linux/50-wg4all
+0 −38 init.d/openwrt/custom.d.examples/50-dht4all
+0 −75 init.d/openwrt/custom.d.examples/50-discord
+1 −7 init.d/openwrt/functions
+18 −29 init.d/openwrt/zapret
+1 −1 init.d/pfsense/zapret.sh
+2 −50 init.d/sysv/functions
+1 −2 init.d/sysv/zapret
+1 −1 install_bin.sh
+34 −11 install_easy.sh
+5 −5 ip2net/Makefile
+1 −1 ipset/antifilter.helper
+13 −1 ipset/def.sh
+1 −1 ipset/get_antizapret_domains.sh
+1 −1 ipset/get_config.sh
+5 −5 ipset/get_reestr_hostlist.sh
+2 −2 ipset/get_reestr_preresolved.sh
+2 −2 ipset/get_reestr_preresolved_smart.sh
+2 −2 ipset/get_reestr_resolvable_domains.sh
+5 −5 ipset/get_reestr_resolve.sh
+2 −2 ipset/get_refilter_domains.sh
+2 −3 ipset/get_refilter_ipsum.sh
+6 −6 mdig/Makefile
+1 −1 nfq/BSDmakefile
+6 −6 nfq/Makefile
+64 −16 nfq/desync.c
+0 −1 nfq/desync.h
+284 −216 nfq/nfqws.c
+1 −3 nfq/params.h
+4 −2 nfq/protocol.c
+0 −4 nfq/sec.c
+1 −1 tpws/BSDmakefile
+5 −5 tpws/Makefile
+7 −7 tpws/helpers.c
+111 −0 tpws/linux_compat.h
+1 −1 tpws/params.h
+1 −1 tpws/protocol.c
+1 −3 tpws/redirect.c
+77 −57 tpws/tpws.c
+1 −0 tpws/tpws_conn.c
Loading

0 comments on commit b0918a6

Please sign in to comment.