mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
init: MODE_OVERRIDE to allow code reuse from custom scripts
This commit is contained in:
parent
83e3f21ced
commit
566e3d1536
@ -395,7 +395,7 @@ zapret_do_firewall()
|
|||||||
{
|
{
|
||||||
# $1 - 1 - add, 0 - del
|
# $1 - 1 - add, 0 - del
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws|filter|custom)
|
tpws|filter|custom)
|
||||||
if [ "$1" = "1" ] ; then
|
if [ "$1" = "1" ] ; then
|
||||||
pf_anchor_root || return 1
|
pf_anchor_root || return 1
|
||||||
@ -438,7 +438,7 @@ zapret_do_daemons()
|
|||||||
|
|
||||||
local opt
|
local opt
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws)
|
tpws)
|
||||||
[ "$1" = "1" ] && [ "$DISABLE_IPV4" = "1" ] && [ "$DISABLE_IPV6" = "1" ] && {
|
[ "$1" = "1" ] && [ "$DISABLE_IPV4" = "1" ] && [ "$DISABLE_IPV6" = "1" ] && {
|
||||||
echo "both ipv4 and ipv6 are disabled. nothing to do"
|
echo "both ipv4 and ipv6 are disabled. nothing to do"
|
||||||
|
@ -457,7 +457,7 @@ zapret_apply_firewall()
|
|||||||
# always create ipsets. ip_exclude ipset is required
|
# always create ipsets. ip_exclude ipset is required
|
||||||
create_ipset no-update
|
create_ipset no-update
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws)
|
tpws)
|
||||||
if [ ! "$MODE_HTTP" = "1" ] && [ ! "$MODE_HTTPS" = "1" ]; then
|
if [ ! "$MODE_HTTP" = "1" ] && [ ! "$MODE_HTTPS" = "1" ]; then
|
||||||
echo both http and https are disabled. not applying redirection.
|
echo both http and https are disabled. not applying redirection.
|
||||||
|
@ -107,7 +107,7 @@ tpws_apply_socks_binds()
|
|||||||
start_service() {
|
start_service() {
|
||||||
local opt qn qns qn6 qns6
|
local opt qn qns qn6 qns6
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws)
|
tpws)
|
||||||
opt="--port=$TPPORT $TPWS_OPT"
|
opt="--port=$TPPORT $TPWS_OPT"
|
||||||
filter_apply_hostlist_target opt
|
filter_apply_hostlist_target opt
|
||||||
|
@ -630,7 +630,7 @@ zapret_do_firewall()
|
|||||||
# always create ipsets. ip_exclude ipset is required
|
# always create ipsets. ip_exclude ipset is required
|
||||||
[ "$1" != "1" ] || create_ipset no-update
|
[ "$1" != "1" ] || create_ipset no-update
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws)
|
tpws)
|
||||||
if [ ! "$MODE_HTTP" = "1" ] && [ ! "$MODE_HTTPS" = "1" ]; then
|
if [ ! "$MODE_HTTP" = "1" ] && [ ! "$MODE_HTTPS" = "1" ]; then
|
||||||
echo both http and https are disabled. not applying redirection.
|
echo both http and https are disabled. not applying redirection.
|
||||||
@ -708,7 +708,7 @@ zapret_do_daemons()
|
|||||||
|
|
||||||
local opt qn qns qn6 qns6
|
local opt qn qns qn6 qns6
|
||||||
|
|
||||||
case "${MODE}" in
|
case "${MODE_OVERRIDE:-$MODE}" in
|
||||||
tpws)
|
tpws)
|
||||||
opt="--port=$TPPORT $TPWS_OPT"
|
opt="--port=$TPPORT $TPWS_OPT"
|
||||||
filter_apply_hostlist_target opt
|
filter_apply_hostlist_target opt
|
||||||
|
Loading…
Reference in New Issue
Block a user