mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Check if proxy config exist or not before actions on openmptcprouter-vps
This commit is contained in:
parent
2b042ee352
commit
178481a749
1 changed files with 12 additions and 12 deletions
|
@ -510,7 +510,7 @@ _get_vps_config() {
|
||||||
ip6resolve="$(resolveip -6 $vpsip | head -n 1)"
|
ip6resolve="$(resolveip -6 $vpsip | head -n 1)"
|
||||||
[ -n "$ip6resolve" ] && vpsip="$ip6resolve"
|
[ -n "$ip6resolve" ] && vpsip="$ip6resolve"
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get shadowsocks-libev.sss0.server)" != "127.0.0.1" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get shadowsocks-libev.sss0)" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "127.0.0.1" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
config_foreach _set_ss_server server "server" $vpsip
|
config_foreach _set_ss_server server "server" $vpsip
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set shadowsocks-libev.sss0.server="$vpsip"
|
set shadowsocks-libev.sss0.server="$vpsip"
|
||||||
|
@ -521,7 +521,7 @@ _get_vps_config() {
|
||||||
/etc/init.d/shadowsocks-libev restart
|
/etc/init.d/shadowsocks-libev restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get shadowsocks-rust.sss0.server)" != "127.0.0.1" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get shadowsocks-rust.sss0)" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "127.0.0.1" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
config_foreach _set_ssrust_server server "server" $vpsip
|
config_foreach _set_ssrust_server server "server" $vpsip
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set shadowsocks-rust.sss0.server="$vpsip"
|
set shadowsocks-rust.sss0.server="$vpsip"
|
||||||
|
@ -532,7 +532,7 @@ _get_vps_config() {
|
||||||
/etc/init.d/shadowsocks-rust restart
|
/etc/init.d/shadowsocks-rust restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get v2ray.omrout.s_vmess_address)" != "127.0.0.1" ] && [ "$(uci -q get v2ray.omrout.s_vmess_address)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get v2ray.omrout)" ] && [ "$(uci -q get v2ray.omrout.s_vmess_address)" != "127.0.0.1" ] && [ "$(uci -q get v2ray.omrout.s_vmess_address)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set v2ray.omrout.s_vmess_address="$vpsip"
|
set v2ray.omrout.s_vmess_address="$vpsip"
|
||||||
set v2ray.omrout.s_vless_address="$vpsip"
|
set v2ray.omrout.s_vless_address="$vpsip"
|
||||||
|
@ -545,7 +545,7 @@ _get_vps_config() {
|
||||||
/etc/init.d/v2ray restart
|
/etc/init.d/v2ray restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get xray.omrout.s_vmess_address)" != "127.0.0.1" ] && [ "$(uci -q get xray.omrout.s_vmess_address)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get xray.omrout)" ] && [ "$(uci -q get xray.omrout.s_vmess_address)" != "127.0.0.1" ] && [ "$(uci -q get xray.omrout.s_vmess_address)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set xray.omrout.s_vmess_address="$vpsip"
|
set xray.omrout.s_vmess_address="$vpsip"
|
||||||
set xray.omrout.s_vless_address="$vpsip"
|
set xray.omrout.s_vless_address="$vpsip"
|
||||||
|
@ -560,7 +560,7 @@ _get_vps_config() {
|
||||||
/etc/init.d/xray restart
|
/etc/init.d/xray restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get openvpn.omr.remote)" != "127.0.0.1" ] && [ "$(uci -q get openvpn.omr.remote)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get openvpn.omr)" ] && [ "$(uci -q get openvpn.omr.remote)" != "127.0.0.1" ] && [ "$(uci -q get openvpn.omr.remote)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set openvpn.omr.remote="$vpsip"
|
set openvpn.omr.remote="$vpsip"
|
||||||
commit openvpn
|
commit openvpn
|
||||||
|
@ -573,7 +573,7 @@ _get_vps_config() {
|
||||||
port="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.port')"
|
port="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.port')"
|
||||||
localip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.client_ip')"
|
localip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.client_ip')"
|
||||||
remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.host_ip')"
|
remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.host_ip')"
|
||||||
if ([ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]) || [ "$(uci -q get dsvpn.vpn.port)" != "$port" ] || [ "$(uci -q get dsvpn.vpn.localip)" != "$localip" ] || [ "$(uci -q get dsvpn.vpn.remoteip)" != "$remoteip" ]; then
|
if [ -n "$(uci -q get dsvpn.vpn)" ] && ([ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]) || [ "$(uci -q get dsvpn.vpn.port)" != "$port" ] || [ "$(uci -q get dsvpn.vpn.localip)" != "$localip" ] || [ "$(uci -q get dsvpn.vpn.remoteip)" != "$remoteip" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set dsvpn.vpn.port=$port
|
set dsvpn.vpn.port=$port
|
||||||
set dsvpn.vpn.localip=$localip
|
set dsvpn.vpn.localip=$localip
|
||||||
|
@ -587,7 +587,7 @@ _get_vps_config() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uci -q get mlvpn.general.host)" != "127.0.0.1" ] && [ "$(uci -q get mlvpn.general.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ] && [ -f /etc/init.d/mlvpn ]; then
|
if [ -n "$(uci -q get mlvpn.general)" ] && [ "$(uci -q get mlvpn.general.host)" != "127.0.0.1" ] && [ "$(uci -q get mlvpn.general.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ] && [ -f /etc/init.d/mlvpn ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set mlvpn.general=mlvpn
|
set mlvpn.general=mlvpn
|
||||||
set mlvpn.general.host="$vpsip"
|
set mlvpn.general.host="$vpsip"
|
||||||
|
@ -598,13 +598,13 @@ _get_vps_config() {
|
||||||
/etc/init.d/mlvpn restart
|
/etc/init.d/mlvpn restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get glorytun.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get glorytun.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get glorytun.vpn)" ] && [ "$(uci -q get glorytun.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get glorytun.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set glorytun.vpn.host="$vpsip"
|
set glorytun.vpn.host="$vpsip"
|
||||||
EOF
|
EOF
|
||||||
glorytun_change=1
|
glorytun_change=1
|
||||||
fi
|
fi
|
||||||
if [ "$(uci -q get glorytun-udp.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get glorytun-udp.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
if [ -n "$(uci -q get glorytun-udp.vpn)" ] && [ "$(uci -q get glorytun-udp.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get glorytun-udp.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set glorytun-udp.vpn.host="$vpsip"
|
set glorytun-udp.vpn.host="$vpsip"
|
||||||
EOF
|
EOF
|
||||||
|
@ -1572,7 +1572,7 @@ _set_config_from_vps() {
|
||||||
#[ -z "$shadowsocks_disabled" ] && shadowsocks_disabled=0
|
#[ -z "$shadowsocks_disabled" ] && shadowsocks_disabled=0
|
||||||
ss_key="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.key')"
|
ss_key="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.key')"
|
||||||
ss_key="$(echo $ss_key | sed 's/-/+/g; s/_/\//g;')"
|
ss_key="$(echo $ss_key | sed 's/-/+/g; s/_/\//g;')"
|
||||||
if [ -n "$ss_key" ] && [ "$ss_key" != "$(uci -q get shadowsocks-libev.sss0.key)" ]; then
|
if [ -n "$ss_key" ] && [ "$ss_key" != "$(uci -q get shadowsocks-libev.sss0.key)" ] && [ -n "$(uci -q get shadowsocks-libev.sss0)" ]; then
|
||||||
ss_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.method')"
|
ss_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.method')"
|
||||||
ss_port="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.port')"
|
ss_port="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.port')"
|
||||||
ss_ebpf="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.ebpf')"
|
ss_ebpf="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.ebpf')"
|
||||||
|
@ -1630,7 +1630,7 @@ _set_config_from_vps() {
|
||||||
#shadowsocks_disabled="$(uci -q get openmptcprouter.settings.shadowsocks_disable)"
|
#shadowsocks_disabled="$(uci -q get openmptcprouter.settings.shadowsocks_disable)"
|
||||||
#[ -z "$shadowsocks_disabled" ] && shadowsocks_disabled=0
|
#[ -z "$shadowsocks_disabled" ] && shadowsocks_disabled=0
|
||||||
ssgo_sskey="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks_go.config.password')"
|
ssgo_sskey="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks_go.config.password')"
|
||||||
if [ -n "$ssgo_sskey" ] && [ "$ssgo_sskey" != "$(uci -q get shadowsocks-rust.sss0.password)" ]; then
|
if [ -n "$ssgo_sskey" ] && [ "$ssgo_sskey" != "$(uci -q get shadowsocks-rust.sss0.password)" ] && [ -n "$(uci -q get shadowsocks-rust.sss0)" ]; then
|
||||||
ss_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks_go.config.protocol')"
|
ss_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks_go.config.protocol')"
|
||||||
ss_port="65280"
|
ss_port="65280"
|
||||||
#ss_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks-rust.fast_open')"
|
#ss_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks-rust.fast_open')"
|
||||||
|
@ -2282,7 +2282,7 @@ _config_service() {
|
||||||
[ -z "$(_set_vpn_vps)" ] && error=1
|
[ -z "$(_set_vpn_vps)" ] && error=1
|
||||||
[ -z "$(_set_proxy_vps)" ] && error=1
|
[ -z "$(_set_proxy_vps)" ] && error=1
|
||||||
fi
|
fi
|
||||||
[ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" = "" ] && uci -q set openmptcprouter.${servername}.get_config=1
|
([ -n "$(uci -q get shadowsocks-libev.sss0)" ] || [ -n "$(uci -q get shadowsocks-rust.sss0)" ]) && [ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" = "" ] && uci -q set openmptcprouter.${servername}.get_config=1
|
||||||
|
|
||||||
#_set_pihole
|
#_set_pihole
|
||||||
[ -n "$wanips" ] && _set_wan_ip
|
[ -n "$wanips" ] && _set_wan_ip
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue