1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 02:51:50 +00:00

Small changes for VPN

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-08-12 21:48:51 +02:00
parent 5a13f3d2f9
commit 8926cb070f
2 changed files with 10 additions and 8 deletions

View file

@ -760,7 +760,7 @@ function interfaces_status()
mArray.openmptcprouter["tun_service"] = false
mArray.openmptcprouter["tun_state"] = ""
mArray.openmptcprouter["tun6_state"] = ""
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
mArray.openmptcprouter["tun_service"] = true
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
local tun_dev = uci:get("network","omrvpn","ifname")

View file

@ -424,14 +424,16 @@ _set_config_from_vps() {
[ -z "$vps_config" ] && return
# Set current VPN
current_vpn="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.current')"
if [ -n "$current_vpn" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.vpn=${current_vpn}
EOF
fi
current_vpn="$(uci -q get openmptcprouter.settings.vpn)"
if [ -z "$current_vpn" ] || [ -n "$vps_lastchange" ]; then
current_vpn="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.current')"
if [ -n "$current_vpn" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.vpn=${current_vpn}
commit openmptcprouter
EOF
fi
fi
# Shadowsocks settings
shadowsocks_disabled="$(uci -q get openmptcprouter.settings.shadowsocks_disable)"