zapret/init.d/macos/custom.d.examples/50-extra-tpws

31 lines
872 B
Plaintext
Raw Normal View History

2021-03-04 17:36:56 +03:00
# this script is an example describing how to run tpws on a custom port
2024-10-12 12:33:06 +03:00
DNUM=100
TPPORT_MY=${TPPORT_MY:-987}
TPWS_OPT_MY=${TPWS_OPT_MY:-987}
TPWS_OPT_SUFFIX_MY="${TPWS_OPT_SUFFIX_MY:-}"
DPORTS_MY=${DPORTS_MY:-20443,20444,30000-30009}
2021-03-04 17:36:56 +03:00
zapret_custom_daemons()
{
# $1 - 1 - run, 0 - stop
local opt="--user=root --port=$TPPORT_MY"
tpws_apply_binds opt
2024-10-12 12:33:06 +03:00
opt="$opt $TPWS_OPT_MY"
2024-09-20 10:23:38 +03:00
filter_apply_hostlist_target opt
2024-10-12 12:33:06 +03:00
filter_apply_suffix opt "$TPWS_OPT_SUFFIX_MY"
do_daemon $1 $DNUM "$TPWS" "$opt"
2021-03-04 17:36:56 +03:00
}
# custom firewall functions echo rules for zapret-v4 and zapret-v6 anchors
# they come after automated table definitions. so you can use <zapret> <zapret6> <zapret-user> ...
zapret_custom_firewall_v4()
{
2024-10-12 12:33:06 +03:00
pf_anchor_zapret_v4_tpws $TPPORT_MY $(replace_char - : $DPORTS_MY)
2021-03-04 17:36:56 +03:00
}
zapret_custom_firewall_v6()
{
2024-10-12 12:33:06 +03:00
pf_anchor_zapret_v6_tpws $TPPORT_MY $(replace_char - : $DPORTS_MY)
2021-03-04 17:36:56 +03:00
}