no print when no public IPv4/v6 address found
This commit is contained in:
parent
e3c6bee566
commit
efcbceb571
@ -27,7 +27,7 @@ __get_ipv4() {
|
|||||||
if __is_public_ipv4 $ipv4; then echo "$ipv4"; return 0; fi
|
if __is_public_ipv4 $ipv4; then echo "$ipv4"; return 0; fi
|
||||||
ipv4=$(host -4 myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')
|
ipv4=$(host -4 myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')
|
||||||
if __is_public_ipv4 $ipv4; then echo "$ipv4"; return 0; fi
|
if __is_public_ipv4 $ipv4; then echo "$ipv4"; return 0; fi
|
||||||
echo "No public IPv4 address found"
|
# echo "No public IPv4 address found"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ __get_ipv6() {
|
|||||||
if [[ $ipv6 =~ ^([0-9a-fA-F]{0,4}:){7}[0-9a-fA-F]{0,4}$ ]]; then echo "$ipv6"; return 0; fi
|
if [[ $ipv6 =~ ^([0-9a-fA-F]{0,4}:){7}[0-9a-fA-F]{0,4}$ ]]; then echo "$ipv6"; return 0; fi
|
||||||
ipv6=$(curl -6 -s ifconfig.me)
|
ipv6=$(curl -6 -s ifconfig.me)
|
||||||
if [[ $ipv6 =~ ^([0-9a-fA-F]{0,4}:){7}[0-9a-fA-F]{0,4}$ ]]; then echo "$ipv6"; return 0; fi
|
if [[ $ipv6 =~ ^([0-9a-fA-F]{0,4}:){7}[0-9a-fA-F]{0,4}$ ]]; then echo "$ipv6"; return 0; fi
|
||||||
echo "No public IPv6 address found"
|
# echo "No public IPv6 address found"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user