mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
init,install_easy: socks mode
This commit is contained in:
@@ -9,6 +9,7 @@ HOSTLIST="$ZHOSTLIST.gz"
|
||||
|
||||
PIDDIR=/var/run
|
||||
TPPORT=988
|
||||
TPWS_USER=daemon
|
||||
TPWS_WAIT="--bind-wait-ip=60"
|
||||
TPWS="$ZAPRET_BASE/tpws/tpws"
|
||||
|
||||
@@ -85,6 +86,7 @@ filter_apply_hostlist_target()
|
||||
# $1 - var name of tpws or nfqws params
|
||||
[ "$MODE_FILTER" = "hostlist" ] && eval $1="\"\$$1 --hostlist=$HOSTLIST\""
|
||||
}
|
||||
|
||||
tpws_apply_binds()
|
||||
{
|
||||
local o
|
||||
@@ -96,6 +98,20 @@ tpws_apply_binds()
|
||||
}
|
||||
eval $1="\"\$$1 $o\""
|
||||
}
|
||||
tpws_apply_socks_binds()
|
||||
{
|
||||
local o
|
||||
|
||||
[ "$DISABLE_IPV4" = "1" ] || {
|
||||
o="--bind-addr=127.0.0.1"
|
||||
[ -n "$IFACE_LAN" ] && o="$o --bind-iface4=$IFACE_LAN $TPWS_WAIT"
|
||||
}
|
||||
[ "$DISABLE_IPV6" = "1" ] || {
|
||||
o="$o --bind-addr=::1"
|
||||
[ -n "$IFACE_LAN" ] && o="$o --bind-iface6=$IFACE_LAN $TPWS_WAIT"
|
||||
}
|
||||
eval $1="\"\$$1 $o\""
|
||||
}
|
||||
|
||||
wait_interface_ll()
|
||||
{
|
||||
@@ -374,6 +390,8 @@ zapret_do_firewall()
|
||||
pf_anchors_clear
|
||||
fi
|
||||
;;
|
||||
tpws-socks)
|
||||
;;
|
||||
*)
|
||||
echo "unsupported MODE=$MODE"
|
||||
return 1
|
||||
@@ -416,6 +434,16 @@ zapret_do_daemons()
|
||||
opt="$opt $TPWS_OPT"
|
||||
do_daemon $1 1 "$TPWS" "$opt"
|
||||
;;
|
||||
tpws-socks)
|
||||
[ "$1" = "1" ] && [ "$DISABLE_IPV4" = "1" ] && [ "$DISABLE_IPV6" = "1" ] && {
|
||||
echo "both ipv4 and ipv6 are disabled. nothing to do"
|
||||
return 0
|
||||
}
|
||||
opt="--socks --user=$TPWS_USER --port=$TPPORT"
|
||||
tpws_apply_socks_binds opt
|
||||
filter_apply_hostlist_target opt
|
||||
do_daemon $1 1 "$TPWS" "$opt"
|
||||
;;
|
||||
filter)
|
||||
;;
|
||||
custom)
|
||||
|
Reference in New Issue
Block a user