mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
485 lines
18 KiB
Bash
Executable file
485 lines
18 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
# shellcheck disable=SC2039
|
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
|
# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
|
# Released under GPL 3. See LICENSE for the full terms.
|
|
|
|
# shellcheck disable=SC2034
|
|
{
|
|
START=90
|
|
STOP=10
|
|
USE_PROCD=1
|
|
EXTRA_COMMANDS="start_interface"
|
|
}
|
|
|
|
. /usr/lib/unbound/iptools.sh
|
|
. /lib/functions/network.sh
|
|
|
|
_validate_section() {
|
|
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_count=$count tmp_tries=$tries tmp_size=$size tmp_max_ttl=$max_ttl tmp_failure_loss=$failure_loss tmp_failure_latency=$failure_latency tmp_recovery_loss=$recovery_loss tmp_recovery_latency=$recovery_latency tmp_reliability=$reliability
|
|
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled tmp_wait_test=$wait_test tmp_server_http_test=$server_http_test tmp_check_quality=$check_quality tmp_failure_interval=$failure_interval tmp_tries_up=$tries_up tmp_family=$family
|
|
|
|
uci_validate_section omr-tracker "$1" "$2" \
|
|
'hosts:list(host)' \
|
|
'hosts6:list(host)' \
|
|
'timeout:uinteger' \
|
|
'size:uinteger' \
|
|
'max_ttl:uinteger' \
|
|
'failure_loss:uinteger' \
|
|
'failure_latency:uinteger' \
|
|
'recovery_loss:uinteger' \
|
|
'recovery_latency:uinteger' \
|
|
'check_quality:bool:0' \
|
|
'count:uinteger' \
|
|
'reliability:uinteger' \
|
|
'tries:uinteger' \
|
|
'tries_up:uinteger' \
|
|
'interval:uinteger' \
|
|
'interval_tries:uinteger' \
|
|
'failure_interval:uinteger' \
|
|
'wait_test:uinteger' \
|
|
'type:string:undef' \
|
|
'enabled:bool:1' \
|
|
'server_http_test:bool:0' \
|
|
'family:string' \
|
|
'options:string'
|
|
|
|
[ -z "$hosts" ] && hosts=$tmp_hosts
|
|
[ -z "$hosts6" ] && hosts6=$tmp_hosts6
|
|
[ -z "$timeout" ] && timeout=$tmp_timeout
|
|
[ -z "$count" ] && count=$tmp_count
|
|
[ -z "$reliability" ] && reliability=$tmp_reliability
|
|
[ -z "$size" ] && size=$tmp_size
|
|
[ -z "$failure_loss" ] && failure_loss=$tmp_failure_loss
|
|
[ -z "$failure_latency" ] && failure_latency=$tmp_failure_latency
|
|
[ -z "$failure_interval" ] && failure_interval=$tmp_failure_interval
|
|
[ -z "$recovery_loss" ] && recovery_loss=$tmp_recovery_loss
|
|
[ -z "$recovery_latency" ] && recovery_latency=$tmp_recovery_latency
|
|
[ -z "$check_quality" ] && check_quality=$tmp_check_quality
|
|
[ -z "$max_ttl" ] && max_ttl=$tmp_max_ttl
|
|
[ -z "$tries" ] && tries=$tmp_tries
|
|
[ -z "$tries_up" ] && tries_up=$tmp_tries_up
|
|
[ -z "$interval" ] && interval=$tmp_interval
|
|
[ -z "$interval_tries" ] && interval_tries=$tmp_interval_tries
|
|
[ -z "$wait_test" ] && wait_test=$tmp_wait_test
|
|
[ -z "$options" ] && options=$tmp_options
|
|
[ "$type" = "undef" ] && type=${tmp_type:-ping}
|
|
[ -z "$server_http_test" ] && server_http_test=$tmp_server_http_test
|
|
[ -z "$family" ] && family=$tmp_family
|
|
[ -z "$enabled" ] && enabled=$tmp_enabled
|
|
}
|
|
|
|
_launch_tracker() {
|
|
case "$1" in
|
|
loopback|lan*|if0*) return;;
|
|
esac
|
|
[ -z "$1" ] && return
|
|
local hosts hosts6 timeout count tries tries_up interval interval_tries options type enabled wait_test ipv6 proto server_http_test size max_ttl failure_loss failure_interval failure_latency recovery_loss recovery_latency family reliability
|
|
_validate_section "defaults" "defaults"
|
|
_validate_section "interface" "$1"
|
|
|
|
local ifname ip4table
|
|
#network_get_device ifname $1
|
|
#[ -z "$ifname" ] && network_get_physdev ifname $1
|
|
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
|
[ -z "$ifname" ] && ifname=$(ifstatus "$1_4" | jsonfilter -q -e '@["l3_device"]')
|
|
#[ -z "$ifname" ] && config_get ifname "$1" device
|
|
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
|
|
|
config_get multipath "$1" multipath
|
|
config_get ifenabled "$1" auto
|
|
config_get gateway "$1" gateway
|
|
config_get ipv6 "$1" ipv6
|
|
config_get proto "$1" proto
|
|
config_get disabled "$1" disabled
|
|
|
|
#[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && [ "$( uci -q get openmptcprouter.$1.multipathvpn)" != "1" ] && return
|
|
([ -z "$multipath" ] || [ "$multipath" = "off" ]) && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && [ "$( uci -q get openmptcprouter.$1.multipathvpn)" != "1" ] && return
|
|
[ "$1" = "omrvpn" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" = "none" ] && return
|
|
[ "${ifenabled}" = "0" ] && return
|
|
[ "${enabled}" = "0" ] && return
|
|
[ "${disabled}" = "1" ] && return
|
|
[ -z "${hosts}" ] && [ "$type" != "none" ] && return
|
|
ifstatus=$(ifstatus "$1" | jsonfilter -q -e '@["up"]')
|
|
ifdevice=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
|
#[ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return
|
|
[ -z "${interval}" ] && interval=2
|
|
[ -z "${interval_tries}" ] && interval_tries=1
|
|
[ -z "${count}" ] && count=2
|
|
[ -z "${max_ttl}" ] && max_ttl=60
|
|
[ -z "${size}" ] && size=56
|
|
[ -z "${check_quality}" ] && check_quality=0
|
|
[ -z "${tries}" ] && tries=5
|
|
[ -z "${reliability}" ] && reliability=1
|
|
[ -z "${tries_up}" ] && tries_up=${tries}
|
|
[ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "1" ] && ipv6="0"
|
|
[ -z "${family}" ] && family='ipv4'
|
|
#[ -z "${failure_interval}" ] && failure_interval=5
|
|
|
|
procd_open_instance "$1"
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker "$1" $options
|
|
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
|
procd_append_param env "OMR_TRACKER_HOSTS6=$hosts6"
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_SIZE=$size"
|
|
procd_append_param env "OMR_TRACKER_CHECK_QUALITY=$check_quality"
|
|
procd_append_param env "OMR_TRACKER_MAX_TTL=$max_ttl"
|
|
procd_append_param env "OMR_TRACKER_FAILURE_LOSS=$failure_loss"
|
|
procd_append_param env "OMR_TRACKER_FAILURE_LATENCY=$failure_latency"
|
|
procd_append_param env "OMR_TRACKER_RECOVERY_LOSS=$recovery_loss"
|
|
procd_append_param env "OMR_TRACKER_RECOVERY_LATENCY=$recovery_latency"
|
|
procd_append_param env "OMR_TRACKER_COUNT=$count"
|
|
procd_append_param env "OMR_TRACKER_RELIABILITY=$reliability"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_TRIES_UP=$tries_up"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_FAILURE_INTERVAL=$failure_interval"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
|
procd_append_param env "OMR_TRACKER_TABLE=$ip4table"
|
|
procd_append_param env "OMR_TRACKER_DEVICE=$ifname"
|
|
procd_append_param env "OMR_TRACKER_DEVICE_GATEWAY=$gateway"
|
|
procd_append_param env "OMR_TRACKER_TYPE=$type"
|
|
procd_append_param env "OMR_TRACKER_FAMILY=$family"
|
|
procd_append_param env "OMR_TRACKER_IPV6=$ipv6"
|
|
procd_append_param env "OMR_TRACKER_PROTO=$proto"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_append_param env "OMR_TRACKER_SERVER_HTTP_TEST=$server_http_test"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 2
|
|
}
|
|
|
|
_launch_server_tracker() {
|
|
local hosts timeout tries interval interval_tries options type enabled wait_test
|
|
_validate_section "defaults" "defaults"
|
|
_validate_section "server" "server"
|
|
|
|
[ "${enabled}" = "0" ] && return
|
|
[ -z "${interval_tries}" ] && interval_tries=1
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-server "$1" $options
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_append_param env "OMR_TRACKER_TYPE=$type"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 2
|
|
}
|
|
|
|
_launch_gre_tracker() {
|
|
local hosts timeout tries interval interval_tries options type enabled wait_test
|
|
_validate_section "defaults" "defaults"
|
|
_validate_section "gre" "gre"
|
|
|
|
[ "${enabled}" = "0" ] && return
|
|
[ -z "${interval_tries}" ] && interval_tries=1
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-gre "$1" $options
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 2
|
|
}
|
|
|
|
_initialize_shadowsocks_tracker() {
|
|
local redir_tcp server tracker_server
|
|
server=$1
|
|
|
|
[ -n "$(echo $server | grep sss)" ] || return
|
|
[ -z "$server" ] && return
|
|
|
|
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
|
#config_get tracker_server ss_rules server
|
|
config_get ss_disabled $server disabled 0
|
|
[ "$ss_disabled" = "0" ] && ss_enable="1"
|
|
[ -z "$(uci -q get shadowsocks-libev.tracker_${server})" ] && [ "$ss_disabled" != "1" ] && {
|
|
logger -t "omr-tracker" "Create ShadowSock tracker ss_local..."
|
|
uci -q batch <<-EOF >/dev/null
|
|
set shadowsocks-libev.tracker_${server}=ss_local
|
|
set shadowsocks-libev.tracker_${server}.server=$server
|
|
set shadowsocks-libev.tracker_${server}.local_address="127.0.0.1"
|
|
set shadowsocks-libev.tracker_${server}.local_port=${count}
|
|
set shadowsocks-libev.tracker_${server}.mode=tcp_and_udp
|
|
set shadowsocks-libev.tracker_${server}.timeout=600
|
|
set shadowsocks-libev.tracker_${server}.fast_open=1
|
|
set shadowsocks-libev.tracker_${server}.syslog=0
|
|
set shadowsocks-libev.tracker_${server}.reuse_port=1
|
|
set shadowsocks-libev.tracker_${server}.mptcp=1
|
|
set shadowsocks-libev.tracker_${server}.verbose=0
|
|
commit shadowsocks-libev
|
|
EOF
|
|
logger -t "omr-tracker" "Restart ShadowSocks"
|
|
/etc/init.d/shadowsocks-libev restart
|
|
}
|
|
# [ -n "$tracker_server" ] && [ "$server" = "$tracker_server" ] || {
|
|
# logger -t "omr-tracker" "Set ShadowSock tracker to current server ($tracker_server -> $server)..."
|
|
# uci -q batch <<-EOF >/dev/null
|
|
# set shadowsocks-libev.tracker.server=$server
|
|
# commit shadowsocks-libev
|
|
# EOF
|
|
# /etc/init.d/shadowsocks-libev restart
|
|
# }
|
|
count=$((count+1))
|
|
}
|
|
|
|
_initialize_shadowsocks_rust_tracker() {
|
|
local redir_tcp server tracker_server
|
|
server=$1
|
|
|
|
[ -n "$(echo $server | grep sss)" ] || return
|
|
[ -z "$server" ] && return
|
|
|
|
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
|
#config_get tracker_server ss_rules server
|
|
config_get ss_rust_disabled $server disabled 0
|
|
[ "$ss_rust_disabled" = "0" ] && ss_rust_enable="1"
|
|
[ -z "$(uci -q get shadowsocks-rust.tracker_${server})" ] && [ "$ss_rust_disabled" != "1" ] && {
|
|
logger -t "omr-tracker" "Create ShadowSock tracker ss_local..."
|
|
uci -q batch <<-EOF >/dev/null
|
|
set shadowsocks-rust.tracker_${server}=ss_local
|
|
set shadowsocks-rust.tracker_${server}.server=$server
|
|
set shadowsocks-rust.tracker_${server}.local_address="127.0.0.1"
|
|
set shadowsocks-rust.tracker_${server}.local_port=${count}
|
|
set shadowsocks-rust.tracker_${server}.mode=tcp_and_udp
|
|
set shadowsocks-rust.tracker_${server}.timeout=600
|
|
set shadowsocks-rust.tracker_${server}.fast_open=0
|
|
set shadowsocks-rust.tracker_${server}.syslog=0
|
|
set shadowsocks-rust.tracker_${server}.reuse_port=1
|
|
set shadowsocks-rust.tracker_${server}.mptcp=1
|
|
set shadowsocks-rust.tracker_${server}.verbose=0
|
|
commit shadowsocks-rust
|
|
EOF
|
|
logger -t "omr-tracker" "Restart ShadowSocks"
|
|
/etc/init.d/shadowsocks-rust restart
|
|
}
|
|
count=$((count+1))
|
|
}
|
|
|
|
_launch_shadowsocks_tracker() {
|
|
local hosts timeout tries interval local_port enabled server wait_test
|
|
|
|
[ "$(echo $1 | grep tracker)" != "" ] || return
|
|
|
|
_validate_section "proxy" "proxy"
|
|
|
|
config_get local_port "$1" local_port
|
|
local disabled
|
|
config_get disabled "$1" disabled 0
|
|
config_get server "$1" server
|
|
|
|
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
|
|
[ -z "$server" ] && return
|
|
[ "$(uci -q get shadowsocks-libev.${server}.disabled)" = "1" ] && return
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-ss "$1"
|
|
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
|
procd_append_param env "OMR_TRACKER_HOSTS6=$hosts6"
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_PROXY=127.0.0.1:$local_port"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_append_param env "OMR_TRACKER_SERVER=$server"
|
|
procd_append_param env "OMR_TRACKER_SS_TYPE=libev"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 1
|
|
}
|
|
|
|
_launch_shadowsocks_rust_tracker() {
|
|
local hosts timeout tries interval local_port enabled server wait_test
|
|
|
|
[ "$(echo $1 | grep tracker)" != "" ] || return
|
|
|
|
_validate_section "proxy" "proxy"
|
|
|
|
config_get local_port "$1" local_port
|
|
local disabled
|
|
config_get disabled "$1" disabled 0
|
|
config_get server "$1" server
|
|
|
|
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
|
|
[ -z "$server" ] && return
|
|
[ "$(uci -q get shadowsocks-rust.${server}.disabled)" = "1" ] && return
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-ss "$1"
|
|
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_PROXY=127.0.0.1:$local_port"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_append_param env "OMR_TRACKER_SERVER=$server"
|
|
procd_append_param env "OMR_TRACKER_SS_TYPE=rust"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 1
|
|
}
|
|
|
|
_launch_v2ray_tracker() {
|
|
local hosts timeout tries interval local_port enabled server wait_test
|
|
|
|
_validate_section "proxy" "proxy"
|
|
[ "$enabled" = "0" ] || [ -z "$hosts" ] && return
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-v2ray "$1"
|
|
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_PROXY=127.0.0.1:1111"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 1
|
|
}
|
|
|
|
_launch_xray_tracker() {
|
|
local hosts timeout tries interval local_port enabled server wait_test
|
|
|
|
_validate_section "proxy" "proxy"
|
|
[ "$enabled" = "0" ] || [ -z "$hosts" ] && return
|
|
|
|
procd_open_instance
|
|
# shellcheck disable=SC2086
|
|
procd_set_param command /bin/omr-tracker-xray "$1"
|
|
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
|
procd_append_param env "OMR_TRACKER_PROXY=127.0.0.1:1111"
|
|
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
|
procd_set_param limits nofile="51200 51200"
|
|
procd_set_param respawn 0 10 0
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
sleep 1
|
|
}
|
|
|
|
_dns_server() {
|
|
local ip=$1
|
|
resolv=$(resolveip -4 ${ip} | head -n 1)
|
|
[ -n "${resolv}" ] && [ "${resolv}" != "${ip}" ] && multiserver=true
|
|
resolv=$(resolveip -6 ${ip} | head -n 1)
|
|
[ -n "${resolv}" ] && [ "${resolv}" != "${ip}" ] && multiserver=true
|
|
ipcount=$((ipcount+1))
|
|
}
|
|
|
|
_multi_server() {
|
|
local ipcount=0
|
|
config_get backup $1 backup
|
|
[ "$backup" = "1" ] && multiserver=true
|
|
config_list_foreach $1 ip _dns_server
|
|
[ "$ipcount" != "0" ] && [ "$ipcount" != "1" ] && multiserver=true
|
|
}
|
|
|
|
_gre_tunnel() {
|
|
config_get proto $1 proto
|
|
[ "$proto" = "gre" ] && gretunnel=true
|
|
}
|
|
|
|
start_interface() {
|
|
[ -z "$1" ] && return
|
|
config_load network
|
|
_launch_tracker $1
|
|
}
|
|
|
|
start_service() {
|
|
local ss_enable=0
|
|
local ss_rust_enable=0
|
|
local instance="$1"
|
|
if [ -z "$instance" ]; then
|
|
logger -t "omr-tracker" "Launching..."
|
|
count=1111
|
|
config_load shadowsocks-libev
|
|
config_foreach _initialize_shadowsocks_tracker server
|
|
|
|
count=1111
|
|
config_load shadowsocks-rust
|
|
config_foreach _initialize_shadowsocks_rust_tracker server
|
|
|
|
if [ "$(uci -q get network.globals.multipath)" = "enable" ]; then
|
|
config_load network
|
|
config_foreach _launch_tracker interface
|
|
fi
|
|
|
|
if [ "$ss_enable" = "1" ]; then
|
|
config_load shadowsocks-libev
|
|
config_foreach _launch_shadowsocks_tracker ss_local
|
|
#elif [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ]; then
|
|
# /etc/init.d/shadowsocks-libev rules_down
|
|
fi
|
|
if [ "$ss_rust_enable" = "1" ]; then
|
|
config_load shadowsocks-rust
|
|
config_foreach _launch_shadowsocks_rust_tracker ss_local
|
|
fi
|
|
config_load v2ray
|
|
config_get v2rayenabled main enabled
|
|
if [ "$v2rayenabled" = "1" ]; then
|
|
_launch_v2ray_tracker
|
|
fi
|
|
|
|
config_load xray
|
|
config_get xrayenabled main enabled
|
|
if [ "$xrayenabled" = "1" ]; then
|
|
_launch_xray_tracker
|
|
fi
|
|
|
|
multiserver=false
|
|
config_load openmptcprouter
|
|
config_foreach _multi_server server
|
|
[ "$multiserver" = true ] && _launch_server_tracker
|
|
gretunnel=false
|
|
config_load network
|
|
config_foreach _gre_tunnel interface
|
|
[ "$gretunnel" = true ] && _launch_gre_tracker
|
|
logger -t "omr-tracker" "Launched"
|
|
else
|
|
config_load network
|
|
_launch_tracker ${instance}
|
|
fi
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger omr-tracker network
|
|
}
|
|
|
|
reload_service() {
|
|
restart "$@"
|
|
}
|
|
|
|
restart_service() {
|
|
stop
|
|
sleep 5
|
|
start "$@"
|
|
}
|