使用ipip.net接口获取外网出口ip

This commit is contained in:
若海 committed 2021-04-21 10:19:47 +08:00
1 parent 228641c55d
commit 1607c2e714
1 file changed
+10 -2
+10 -2
View File
@@ -43,9 +43,9 @@ arWanIp4() {
if [ -z "$hostIp" ]; then
if type wget >/dev/null 2>&1; then
hostIp=$(wget -q -O- http://members.3322.org/dyndns/getip)
hostIp=$(wget -q -O- https://v4.myip.la)
else
hostIp=$(curl -s http://members.3322.org/dyndns/getip)
hostIp=$(curl -s https://v4.myip.la)
fi
fi
@@ -80,6 +80,14 @@ arWanIp6() {
;;
esac
if [ -z "$hostIp" ]; then
if type wget >/dev/null 2>&1; then
hostIp=$(wget -q -O- https://v6.myip.la)
else
hostIp=$(curl -s https://v6.myip.la)
fi
fi
if [ -z "$hostIp" ]; then
echo "arWanIp6 - Can't get ip address"
return 1