1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
This commit is contained in:
suyuan 2024-08-02 00:34:07 +08:00 committed by GitHub
commit c5684e0d93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1627,7 +1627,7 @@ _set_config_from_vps() {
config_foreach _set_ss_server server "server" $vpsip config_foreach _set_ss_server server "server" $vpsip
fi fi
uci -q commit shadowsocks-libev uci -q commit shadowsocks-libev
if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ]; then if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ -n "$(uci -q changes shadowsocks-libev)" ]; then
logger -t "OMR-VPS" "Shadowsocks restart..." logger -t "OMR-VPS" "Shadowsocks restart..."
/etc/init.d/shadowsocks-libev restart >/dev/null 2>&1 /etc/init.d/shadowsocks-libev restart >/dev/null 2>&1
fi fi
@ -1655,7 +1655,7 @@ _set_config_from_vps() {
config_foreach _set_ssrust_server server "server" $vpsip config_foreach _set_ssrust_server server "server" $vpsip
fi fi
uci -q commit shadowsocks-rust uci -q commit shadowsocks-rust
if [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ]; then if [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ -n "$(uci -q changes shadowsocks-rust)" ]; then
logger -t "OMR-VPS" "Shadowsocks Rust restart..." logger -t "OMR-VPS" "Shadowsocks Rust restart..."
/etc/init.d/shadowsocks-rust restart >/dev/null 2>&1 /etc/init.d/shadowsocks-rust restart >/dev/null 2>&1
fi fi
@ -1683,7 +1683,7 @@ _set_config_from_vps() {
uci -q set v2ray.omrout.s_socks_address="$vpsip" uci -q set v2ray.omrout.s_socks_address="$vpsip"
fi fi
uci -q commit v2ray uci -q commit v2ray
if [ "$(uci -q get v2ray.main.enabled)" = "1" ]; then if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -n "$(uci -q changes v2ray)" ]; then
logger -t "OMR-VPS" "V2ray restart..." logger -t "OMR-VPS" "V2ray restart..."
/etc/init.d/v2ray restart >/dev/null 2>&1 /etc/init.d/v2ray restart >/dev/null 2>&1
fi fi
@ -1720,7 +1720,7 @@ _set_config_from_vps() {
uci -q set xray.omrout.s_shadowsocks_address="$vpsip" uci -q set xray.omrout.s_shadowsocks_address="$vpsip"
fi fi
uci -q commit xray uci -q commit xray
if [ "$(uci -q get xray.main.enabled)" = "1" ]; then if [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -n "$(uci -q changes xray)" ]; then
logger -t "OMR-VPS" "Xray restart..." logger -t "OMR-VPS" "Xray restart..."
/etc/init.d/xray restart >/dev/null 2>&1 /etc/init.d/xray restart >/dev/null 2>&1
fi fi
@ -1749,9 +1749,11 @@ _set_config_from_vps() {
uci -q set glorytun.vpn.host="$vpsip" uci -q set glorytun.vpn.host="$vpsip"
fi fi
uci -q commit glorytun uci -q commit glorytun
if [ -n "$(uci -q changes glorytun)" ]; then
logger -t "OMR-VPS" "Glorytun restart..." logger -t "OMR-VPS" "Glorytun restart..."
/etc/init.d/glorytun restart >/dev/null 2>&1 /etc/init.d/glorytun restart >/dev/null 2>&1
fi fi
fi
if [ -n "$(uci -q get glorytun.udp)" ] && (([ -n "$glorytun_key" ] && [ "$glorytun_key" != "$(uci -q get glorytun-udp.vpn.key)" ]) || ([ -n "$glorytun_port" ] || [ "$glorytun_port" != "$(uci -q get glorytun-udp.vpn.port)" ])); then if [ -n "$(uci -q get glorytun.udp)" ] && (([ -n "$glorytun_key" ] && [ "$glorytun_key" != "$(uci -q get glorytun-udp.vpn.key)" ]) || ([ -n "$glorytun_port" ] || [ "$glorytun_port" != "$(uci -q get glorytun-udp.vpn.port)" ])); then
vpn="$(uci -q get openmptcprouter.settings.vpn)" vpn="$(uci -q get openmptcprouter.settings.vpn)"
glorytun_state=0 glorytun_state=0
@ -1772,9 +1774,11 @@ _set_config_from_vps() {
uci -q set glorytun-udp.vpn.host="$vpsip" uci -q set glorytun-udp.vpn.host="$vpsip"
fi fi
uci -q commit glorytun-udp uci -q commit glorytun-udp
if [ -n "$(uci -q changes glorytun-udp)" ]; then
logger -t "OMR-VPS" "Glorytun UDP restart..." logger -t "OMR-VPS" "Glorytun UDP restart..."
/etc/init.d/glorytun-udp restart >/dev/null 2>&1 /etc/init.d/glorytun-udp restart >/dev/null 2>&1
fi fi
fi
# OpenVPN settings # OpenVPN settings
openvpn_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.key')" openvpn_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.key')"
@ -1800,8 +1804,10 @@ _set_config_from_vps() {
uci -q set openvpn.omr.remote="$vpsip" uci -q set openvpn.omr.remote="$vpsip"
fi fi
uci -q commit openvpn uci -q commit openvpn
if [ -n "$(uci -q changes openvpn)" ]; then
logger -t "OMR-VPS" "OpenVPN restart..." logger -t "OMR-VPS" "OpenVPN restart..."
/etc/init.d/openvpn restart /etc/init.d/openvpn restart
fi
} }
openvpn_client_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_key')" openvpn_client_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_key')"
[ -n "$openvpn_client_key" ] && { [ -n "$openvpn_client_key" ] && {
@ -1837,8 +1843,10 @@ _set_config_from_vps() {
uci -q add_list openvpn.omr.remote="$vpsip" uci -q add_list openvpn.omr.remote="$vpsip"
fi fi
uci -q commit openvpn uci -q commit openvpn
if [ -n "$(uci -q changes openvpn)" ]; then
logger -t "OMR-VPS" "OpenVPN restart..." logger -t "OMR-VPS" "OpenVPN restart..."
/etc/init.d/openvpn restart /etc/init.d/openvpn restart
fi
} }
# MLVPN settings # MLVPN settings
@ -1858,9 +1866,11 @@ _set_config_from_vps() {
uci -q set mlvpn.general.host="$vpsip" uci -q set mlvpn.general.host="$vpsip"
fi fi
uci -q commit mlvpn uci -q commit mlvpn
if [ -n "$(uci -q changes mlvpn)" ]; then
logger -t "OMR-VPS" "MLVPN restart..." logger -t "OMR-VPS" "MLVPN restart..."
/etc/init.d/mlvpn restart /etc/init.d/mlvpn restart
fi fi
fi
# DSVPN settings # DSVPN settings
dsvpn_key="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.key')" dsvpn_key="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.key')"
@ -1880,9 +1890,11 @@ _set_config_from_vps() {
uci -q set dsvpn.vpn.host="$vpsip" uci -q set dsvpn.vpn.host="$vpsip"
fi fi
uci -q commit dsvpn uci -q commit dsvpn
if [ -n "$(uci -q changes dsvpn)" ]; then
logger -t "OMR-VPS" "DSVPN restart..." logger -t "OMR-VPS" "DSVPN restart..."
/etc/init.d/dsvpn restart /etc/init.d/dsvpn restart
fi fi
fi
# Shorewall settings # Shorewall settings
shorewall_redirect="$(echo "$vps_config" | jsonfilter -q -e '@.shorewall.redirect_ports')" shorewall_redirect="$(echo "$vps_config" | jsonfilter -q -e '@.shorewall.redirect_ports')"
@ -1929,11 +1941,11 @@ _set_config_from_vps() {
vps_ipv6_addr="$(echo "$vps_config" | jsonfilter -q -e '@.network.ipv6')" vps_ipv6_addr="$(echo "$vps_config" | jsonfilter -q -e '@.network.ipv6')"
if [ -z "$vps_ipv6_addr" ]; then if [ -z "$vps_ipv6_addr" ]; then
if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ]; then if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ]; then
logger -t "OMR-VPS" "No IPv6 support on VPS side. IPv6 disabled." logger -t "OMR-VPS" "No IPv6 support on VPS side ?"
fi fi
uci -q batch <<-EOF >/dev/null #uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.disable_ipv6=1 # set openmptcprouter.settings.disable_ipv6=1
EOF #EOF
#sysctl -qw net.ipv6.conf.all.disable_ipv6=1 #sysctl -qw net.ipv6.conf.all.disable_ipv6=1
else else
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
@ -1950,9 +1962,11 @@ _set_config_from_vps() {
set network.omr6in4.gateway="$omr6in4_vps_localip" set network.omr6in4.gateway="$omr6in4_vps_localip"
commit network commit network
EOF EOF
if [ -n "$(uci -q changes network)" ]; then
/etc/init.d/network reload /etc/init.d/network reload
sleep 6 sleep 6
fi fi
fi
# Get VPS iperf config # Get VPS iperf config
iperf_user="$(echo "$vps_config" | jsonfilter -q -e '@.iperf.user')" iperf_user="$(echo "$vps_config" | jsonfilter -q -e '@.iperf.user')"
@ -2295,7 +2309,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
([ -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 ([ -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.password)" = "" ] && uci -q set openmptcprouter.${servername}.get_config=1
#_set_pihole #_set_pihole
[ -n "$wanips" ] && _set_wan_ip [ -n "$wanips" ] && _set_wan_ip