mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 05:44:03 +02:00
Update run
This commit is contained in:
@@ -14,16 +14,20 @@ if [ -f /currentip ]; then
|
|||||||
else
|
else
|
||||||
curl -s ipecho.net/plain --interface tun0 > /vpnip
|
curl -s ipecho.net/plain --interface tun0 > /vpnip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compare ip
|
# Verify ip has changed
|
||||||
if [[ "$(cat /vpnip)" = "$(cat /currentip)" ]]; then
|
if [[ "$(cat /vpnip)" = "$(cat /currentip)" ]]; then
|
||||||
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
||||||
bashio::exit.nok
|
bashio::exit.nok
|
||||||
else
|
|
||||||
bashio::log.info "VPN is up and running with ip $(curl -s ipecho.net/plain)"
|
|
||||||
rm /vpnip
|
|
||||||
rm /currentip
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get ip location
|
||||||
|
COUNTRY=$"(curl -s https://ipinfo.io/"$(cat /vpnip)" | grep country -i -m 1 | cut -d ':' -f 2 |xargs | awk 'gsub(/,$/,x)' || true)"
|
||||||
|
|
||||||
|
# Inform by message
|
||||||
|
bashio::log.info "VPN is up and running with ip $(curl -s ipecho.net/plain), based in country : $COUNTRY"
|
||||||
|
rm /vpnip
|
||||||
|
rm /currentip
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user