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:
@@ -34,8 +34,9 @@ HOSTLIST="$ZAPRET_BASE/ipset/zapret-hosts.txt.gz"
|
||||
TPWS_OPT_BASE="--user=$TPWS_USER --port=$TPPORT"
|
||||
TPWS_OPT_BASE4="--bind-addr=$TPWS_LOCALHOST4"
|
||||
TPWS_OPT_BASE6="--bind-addr=::1"
|
||||
TPWS_WAIT="--bind-wait-ifup=30 --bind-wait-ip=30"
|
||||
# first wait for lan to ifup, then wait for bind-wait-ip-linklocal seconds for link local address and bind-wait-ip for any ipv6 as the worst case
|
||||
TPWS_OPT_BASE6_PRE="--bind-linklocal=prefer --bind-wait-ifup=30 --bind-wait-ip=30 --bind-wait-ip-linklocal=3"
|
||||
TPWS_OPT_BASE6_PRE="--bind-linklocal=prefer $TPWS_WAIT --bind-wait-ip-linklocal=3"
|
||||
|
||||
run_daemon()
|
||||
{
|
||||
@@ -64,11 +65,11 @@ run_tpws()
|
||||
network_get_device DEVICE lan
|
||||
[ -n "$DEVICE" ] && OPT="$OPT --bind-iface6=$DEVICE $TPWS_OPT_BASE6_PRE"
|
||||
}
|
||||
run_daemon $1 $TPWS "$OPT $2"
|
||||
run_daemon $1 "$TPWS" "$OPT $2"
|
||||
}
|
||||
stop_tpws()
|
||||
{
|
||||
stop_daemon $1 $TPWS
|
||||
stop_daemon $1 "$TPWS"
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +79,23 @@ filter_apply_hostlist_target()
|
||||
[ "$MODE_FILTER" = "hostlist" ] && eval $1="\"\$$1 --hostlist=$HOSTLIST\""
|
||||
}
|
||||
|
||||
tpws_apply_socks_binds()
|
||||
{
|
||||
local o
|
||||
|
||||
network_get_device DEVICE lan
|
||||
|
||||
[ "$DISABLE_IPV4" = "1" ] || {
|
||||
o="--bind-addr=127.0.0.1"
|
||||
[ -n "$DEVICE" ] && o="$o --bind-iface4=$DEVICE $TPWS_WAIT"
|
||||
}
|
||||
[ "$DISABLE_IPV6" = "1" ] || {
|
||||
o="$o --bind-addr=::1"
|
||||
[ -n "$DEVICE" ] && o="$o --bind-iface6=$DEVICE $TPWS_WAIT"
|
||||
}
|
||||
eval $1="\"\$$1 $o\""
|
||||
}
|
||||
|
||||
|
||||
start_service() {
|
||||
local opt
|
||||
@@ -88,10 +106,16 @@ start_service() {
|
||||
filter_apply_hostlist_target opt
|
||||
run_tpws 1 "$opt"
|
||||
;;
|
||||
tpws-socks)
|
||||
opt="$TPWS_OPT_BASE --socks $TPWS_OPT"
|
||||
tpws_apply_socks_binds opt
|
||||
filter_apply_hostlist_target opt
|
||||
run_daemon 1 "$TPWS" "$opt"
|
||||
;;
|
||||
nfqws)
|
||||
opt="$NFQWS_OPT_BASE $NFQWS_OPT_DESYNC"
|
||||
filter_apply_hostlist_target opt
|
||||
run_daemon 1 $NFQWS "$opt"
|
||||
run_daemon 1 "$NFQWS" "$opt"
|
||||
;;
|
||||
custom)
|
||||
existf zapret_custom_daemons && zapret_custom_daemons $1
|
||||
|
Reference in New Issue
Block a user