1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
adguardhome_ynh/scripts/_common.sh
OniriCorpe 5bdc4b9203 typo
2023-12-27 06:36:59 +01:00

34 lines
841 B
Bash

#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
is_public_ip(){
# used to discriminate publics IPs over privates IPs
local IP="$1"
if [[ "$IP" =~ ^10.*|^169.*|^172.*|^192.168.* ]] ; then
# private ipv4, so false
return 1
elif [[ "$IP" =~ ^fc*|^fd*|^fe80:* ]] ; then
# private ipv6, so false
return 1
else
# public ip, so true
return 0
fi
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================