mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix when VPS API doesn't answer
This commit is contained in:
parent
8f499e9f2f
commit
df4708ee92
1 changed files with 4 additions and 3 deletions
|
@ -218,7 +218,7 @@ _get_vps_config() {
|
||||||
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.client_ip')"
|
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.client_ip')"
|
||||||
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.host_ip')"
|
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.host_ip')"
|
||||||
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
|
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
|
||||||
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ]; then
|
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ] && [ "$port" != "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set glorytun.vpn.port=$port
|
set glorytun.vpn.port=$port
|
||||||
EOF
|
EOF
|
||||||
|
@ -262,7 +262,7 @@ _get_vps_config() {
|
||||||
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.client_ip')"
|
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.client_ip')"
|
||||||
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.host_ip')"
|
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.host_ip')"
|
||||||
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
|
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
|
||||||
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ]; then
|
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ] && [ "$port" != "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set glorytun.vpn.port=$port
|
set glorytun.vpn.port=$port
|
||||||
EOF
|
EOF
|
||||||
|
@ -391,7 +391,7 @@ _get_gre_tunnel() {
|
||||||
peeraddr="$(echo $tunnel | jsonfilter -q -e '@.remote_ip')"
|
peeraddr="$(echo $tunnel | jsonfilter -q -e '@.remote_ip')"
|
||||||
ipaddr="$(echo $tunnel | jsonfilter -q -e '@.local_ip')"
|
ipaddr="$(echo $tunnel | jsonfilter -q -e '@.local_ip')"
|
||||||
publicaddr="$(echo $tunnel | jsonfilter -q -e '@.public_ip')"
|
publicaddr="$(echo $tunnel | jsonfilter -q -e '@.public_ip')"
|
||||||
if [ "$(uci -q get network.omrip${i}.peeraddr)" != "$peeraddr" ] || [ "$(uci -q get network.omrip${i}.ipaddr)" != "$ipaddr" ] || [ "$(uci -q get network.omrip${i}gre.ipaddr)" != "$vpnip_local" ]; then
|
if [ "$peeraddr" != "" ] && [ "$ipaddr" != "" ] && [ "$publicaddr" != "" ] && ([ "$(uci -q get network.omrip${i}.peeraddr)" != "$peeraddr" ] || [ "$(uci -q get network.omrip${i}.ipaddr)" != "$ipaddr" ] || [ "$(uci -q get network.omrip${i}gre.ipaddr)" != "$vpnip_local" ]); then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set network.omrip${i}gre=interface
|
set network.omrip${i}gre=interface
|
||||||
set network.omrip${i}gre.label="GRE tunnel for $publicaddr"
|
set network.omrip${i}gre.label="GRE tunnel for $publicaddr"
|
||||||
|
@ -1415,6 +1415,7 @@ _config_service() {
|
||||||
|
|
||||||
_get_vps_config
|
_get_vps_config
|
||||||
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
|
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
|
||||||
|
[ -z "$vps_config" ] && return
|
||||||
user_permission="$(echo "$vps_config" | jsonfilter -q -e '@.user.permission')"
|
user_permission="$(echo "$vps_config" | jsonfilter -q -e '@.user.permission')"
|
||||||
|
|
||||||
if [ "$(uci -q get openmptcprouter.settings.firstboot)" != "0" ]; then
|
if [ "$(uci -q get openmptcprouter.settings.firstboot)" != "0" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue