mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2025-12-31 11:56:02 +03:00
custom.d: Add Stun4ALL script (50-script.sh)
This commit is contained in:
@@ -87,6 +87,10 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret/ipset_def/zapret-hosts-user.txt
|
||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret/ipset_def/zapret-hosts-user-exclude.txt
|
||||
$(INSTALL_DATA) ./ipset/zapret-ip-exclude.txt $(1)/opt/zapret/ipset_def/zapret-ip-exclude.txt
|
||||
$(INSTALL_DIR) $(1)/opt/zapret/init.d
|
||||
$(INSTALL_DIR) $(1)/opt/zapret/init.d/openwrt
|
||||
$(INSTALL_DIR) $(1)/opt/zapret/init.d/openwrt/custom.d
|
||||
$(CP) ./custom.d/* $(1)/opt/zapret/init.d/openwrt/custom.d/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret-uci-def-cfg.sh
|
||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/opt/zapret/uci-def-cfg.sh
|
||||
@@ -98,6 +102,7 @@ define Package/$(PKG_NAME)/install
|
||||
# Fix permisions
|
||||
chmod 644 $(1)/opt/zapret/ipset/*.txt
|
||||
chmod 644 $(1)/opt/zapret/ipset_def/*.txt
|
||||
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
||||
chmod 644 $(1)/opt/zapret/config.default
|
||||
chmod 755 $(1)/opt/zapret/*.sh
|
||||
endef
|
||||
|
||||
31
zapret/custom.d/50-script.sh
Normal file
31
zapret/custom.d/50-script.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
# Stun4ALL (discord audio, discord video, telegram call, etc)
|
||||
# this custom script runs desync to all stun packets
|
||||
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
|
||||
|
||||
# can override in config :
|
||||
NFQWS_OPT_DESYNC_STUN="${NFQWS_OPT_DESYNC_STUN:---dpi-desync=fake --dpi-desync-repeats=2}"
|
||||
|
||||
alloc_dnum DNUM_STUN4ALL
|
||||
alloc_qnum QNUM_STUN4ALL
|
||||
|
||||
zapret_custom_daemons()
|
||||
{
|
||||
# $1 - 1 - add, 0 - stop
|
||||
|
||||
local opt="--qnum=$QNUM_STUN4ALL $NFQWS_OPT_DESYNC_STUN"
|
||||
do_nfqws $1 $DNUM_STUN4ALL "$opt"
|
||||
}
|
||||
zapret_custom_firewall()
|
||||
{
|
||||
# $1 - 1 - run, 0 - stop
|
||||
|
||||
local f='-p udp -m u32 --u32'
|
||||
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=28:65535&&0>>22&0x3C@12=0x2112A442&&0>>22&0x3C@8&0xC0000003=0" "$f 44>>16=28:65535&&52=0x2112A442&&48&0xC0000003=0" $QNUM_STUN4ALL
|
||||
}
|
||||
zapret_custom_firewall_nft()
|
||||
{
|
||||
# stop logic is not required
|
||||
|
||||
local f="udp length >= 28 @ih,32,32 0x2112A442 @ih,0,2 0 @ih,30,2 0"
|
||||
nft_fw_nfqws_post "$f" "$f" $QNUM_STUN4ALL
|
||||
}
|
||||
Reference in New Issue
Block a user