mirror of https://github.com/bol-van/zapret/
5 changed files with 138 additions and 32 deletions
@ -0,0 +1,46 @@ |
|||
# this custom script demonstrates how to reuse built-in modes and add something from yourself |
|||
|
|||
MY_TPPORT=$(($TPPORT + 1)) |
|||
MY_TPWS_OPT="--methodeol --hostcase" |
|||
MY_DPORT=81 |
|||
|
|||
zapret_custom_daemons() |
|||
{ |
|||
# stop logic is managed by procd |
|||
local MODE_OVERRIDE=tpws |
|||
local opt |
|||
|
|||
start_daemons_procd |
|||
|
|||
opt="--port=$MY_TPPORT $MY_TPWS_OPT" |
|||
filter_apply_hostlist_target opt |
|||
run_tpws 100 "$opt" |
|||
} |
|||
zapret_custom_firewall() |
|||
{ |
|||
# $1 - 1 - run, 0 - stop |
|||
|
|||
local MODE_OVERRIDE=tpws |
|||
local f4 f6 |
|||
|
|||
zapret_do_firewall_rules_ipt $1 |
|||
|
|||
f4="--dport $MY_DPORT" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_tpws $1 "$f4" "$f6" $MY_TPPORT |
|||
} |
|||
zapret_custom_firewall_nft() |
|||
{ |
|||
# stop logic is not required |
|||
|
|||
local MODE_OVERRIDE=tpws |
|||
local f4 f6 |
|||
|
|||
zapret_apply_firewall_rules_nft |
|||
|
|||
f4="tcp dport $MY_DPORT" |
|||
f6=$f4 |
|||
nft_filter_apply_ipset_target f4 f6 |
|||
nft_fw_tpws "$f4" "$f6" $MY_TPPORT |
|||
} |
@ -0,0 +1,47 @@ |
|||
# this custom script demonstrates how to reuse built-in modes and add something from yourself |
|||
|
|||
MY_TPPORT=$(($TPPORT + 1)) |
|||
MY_TPWS_OPT="--methodeol --hostcase" |
|||
MY_DPORT=81 |
|||
|
|||
zapret_custom_daemons() |
|||
{ |
|||
# $1 - 1 - run, 0 - stop |
|||
|
|||
local MODE_OVERRIDE=tpws |
|||
local opt |
|||
|
|||
zapret_do_daemons $1 |
|||
|
|||
opt="--port=$MY_TPPORT $MY_TPWS_OPT" |
|||
filter_apply_hostlist_target opt |
|||
do_tpws $1 100 "$opt" |
|||
} |
|||
zapret_custom_firewall() |
|||
{ |
|||
# $1 - 1 - run, 0 - stop |
|||
|
|||
local MODE_OVERRIDE=tpws |
|||
local f4 f6 |
|||
|
|||
zapret_do_firewall_rules_ipt $1 |
|||
|
|||
f4="--dport $MY_DPORT" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_tpws $1 "$f4" "$f6" $MY_TPPORT |
|||
} |
|||
zapret_custom_firewall_nft() |
|||
{ |
|||
# stop logic is not required |
|||
|
|||
local MODE_OVERRIDE=tpws |
|||
local f4 f6 |
|||
|
|||
zapret_apply_firewall_rules_nft |
|||
|
|||
f4="tcp dport $MY_DPORT" |
|||
f6=$f4 |
|||
nft_filter_apply_ipset_target f4 f6 |
|||
nft_fw_tpws "$f4" "$f6" $MY_TPPORT |
|||
} |
Loading…
Reference in new issue