mirror of
https://github.com/bol-van/zapret.git
synced 2025-08-10 01:02:03 +03:00
shellcheck
linting and formatting shell scripts
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# this custom script demonstrates how to apply tpws to http and nfqws to https
|
||||
# it preserves config settings : MODE_HTTP, MODE_HTTPS, MODE_FILTER, TPWS_OPT, NFQWS_OPT_DESYNC, NFQWS_OPT_DESYNC_HTTPS
|
||||
|
||||
zapret_custom_daemons()
|
||||
{
|
||||
zapret_custom_daemons() {
|
||||
# $1 - 1 - run, 0 - stop
|
||||
|
||||
local opt
|
||||
@@ -10,17 +9,16 @@ zapret_custom_daemons()
|
||||
[ "$MODE_HTTP" = "1" ] && {
|
||||
opt="--port=$TPPORT $TPWS_OPT"
|
||||
filter_apply_hostlist_target opt
|
||||
do_tpws $1 1 "$opt"
|
||||
do_tpws "$1" 1 "$opt"
|
||||
}
|
||||
|
||||
[ "$MODE_HTTPS" = "1" ] && {
|
||||
opt="--qnum=$QNUM $NFQWS_OPT_DESYNC_HTTPS"
|
||||
filter_apply_hostlist_target opt
|
||||
do_nfqws $1 2 "$opt"
|
||||
do_nfqws "$1" 2 "$opt"
|
||||
}
|
||||
}
|
||||
zapret_custom_firewall()
|
||||
{
|
||||
zapret_custom_firewall() {
|
||||
# $1 - 1 - run, 0 - stop
|
||||
|
||||
local f4 f6
|
||||
@@ -31,20 +29,19 @@ zapret_custom_firewall()
|
||||
f4="-p tcp -m multiport --dports $HTTP_PORTS_IPT"
|
||||
f6=$f4
|
||||
filter_apply_ipset_target f4 f6
|
||||
fw_tpws $1 "$f4" "$f6" $TPPORT
|
||||
fw_tpws "$1" "$f4" "$f6" "$TPPORT"
|
||||
}
|
||||
|
||||
|
||||
[ "$MODE_HTTPS" = "1" ] && {
|
||||
f4="-p tcp -m multiport --dports $HTTPS_PORTS_IPT $first_packet_only"
|
||||
f6=$f4
|
||||
filter_apply_ipset_target f4 f6
|
||||
fw_nfqws_post $1 "$f4 $desync" "$f6 $desync" $QNUM
|
||||
fw_nfqws_post "$1" "$f4 $desync" "$f6 $desync" "$QNUM"
|
||||
# for modes that require incoming traffic
|
||||
fw_reverse_nfqws_rule $1 "$f4" "$f6" $QNUM
|
||||
fw_reverse_nfqws_rule "$1" "$f4" "$f6" "$QNUM"
|
||||
}
|
||||
}
|
||||
zapret_custom_firewall_nft()
|
||||
{
|
||||
zapret_custom_firewall_nft() {
|
||||
# stop logic is not required
|
||||
|
||||
local f4 f6
|
||||
@@ -55,15 +52,15 @@ zapret_custom_firewall_nft()
|
||||
f4="tcp dport {$HTTP_PORTS}"
|
||||
f6=$f4
|
||||
nft_filter_apply_ipset_target f4 f6
|
||||
nft_fw_tpws "$f4" "$f6" $TPPORT
|
||||
nft_fw_tpws "$f4" "$f6" "$TPPORT"
|
||||
}
|
||||
|
||||
|
||||
[ "$MODE_HTTPS" = "1" ] && {
|
||||
f4="tcp dport {$HTTPS_PORTS} $first_packet_only"
|
||||
f6=$f4
|
||||
nft_filter_apply_ipset_target f4 f6
|
||||
nft_fw_nfqws_post "$f4 $desync" "$f6 $desync" $QNUM
|
||||
nft_fw_nfqws_post "$f4 $desync" "$f6 $desync" "$QNUM"
|
||||
# for modes that require incoming traffic
|
||||
nft_fw_reverse_nfqws_rule "$f4" "$f6" $QNUM
|
||||
nft_fw_reverse_nfqws_rule "$f4" "$f6" "$QNUM"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user