mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
better comments
This commit is contained in:
parent
f4a305decb
commit
5d35c03559
1 changed files with 7 additions and 4 deletions
|
@ -10,17 +10,19 @@
|
||||||
|
|
||||||
is_public_ip(){
|
is_public_ip(){
|
||||||
# used to discriminate publics IPs over privates IPs
|
# used to discriminate publics IPs over privates IPs
|
||||||
|
# private IPv4 start with: 10.; 169.; 172. or 192.168.
|
||||||
|
# private IPv6 start with: fc; fd or fe80:
|
||||||
|
|
||||||
local IP="$1"
|
local IP="$1"
|
||||||
|
|
||||||
if [[ "$IP" =~ ^10.*|^169.*|^172.*|^192.168.* ]] ; then
|
if [[ "$IP" =~ ^10.*|^169.*|^172.*|^192.168.* ]] ; then
|
||||||
# private ipv4, so false
|
# private IPv4, so false
|
||||||
return 1
|
return 1
|
||||||
elif [[ "$IP" =~ ^fc*|^fd*|^fe80:* ]] ; then
|
elif [[ "$IP" =~ ^fc*|^fd*|^fe80:* ]] ; then
|
||||||
# private ipv6, so false
|
# private IPv6, so false
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
# public ip, so true
|
# public IP, so true
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -32,9 +34,10 @@ process_ips(){
|
||||||
|
|
||||||
for i in $(seq "$(echo "$ips" | wc -w)" -1 1); do
|
for i in $(seq "$(echo "$ips" | wc -w)" -1 1); do
|
||||||
ip=$(echo "$ips" | awk "{print \$$i}")
|
ip=$(echo "$ips" | awk "{print \$$i}")
|
||||||
|
# check if the so-called IP really is one
|
||||||
if ynh_validate_ip4 --ip_address="$ip"; then
|
if ynh_validate_ip4 --ip_address="$ip"; then
|
||||||
|
# if the IP is public and the user doesn't want to expose port 53, skip it
|
||||||
if is_public_ip "$ip" && [ "$open_port_53" == "false" ] ; then
|
if is_public_ip "$ip" && [ "$open_port_53" == "false" ] ; then
|
||||||
# if the IP is public and the user doesn't want to expose port 53, skip it
|
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
ips="$ip"
|
ips="$ip"
|
||||||
|
|
Loading…
Add table
Reference in a new issue