1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

get dsvpn ips

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-01-11 21:46:00 +01:00
parent cebc7ba49a
commit dd7a3a2281

View file

@ -278,11 +278,17 @@ _get_vps_config() {
/etc/init.d/openvpn restart /etc/init.d/openvpn restart
fi fi
port="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.port')" port="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.port')"
if [ "$(uci -q get dsvpn.vpn.port)" != "$port" ]; then localip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.client_ip')"
remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.host_ip')"
if [ "$(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.remoteip=$remoteip
commit dsvpn commit dsvpn
EOF EOF
logger -t "OMR-VPS" "Restart DSVPN..."
/etc/init.d/dsvpn restart
fi fi
if [ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ]; then if [ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ]; then