We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc4e053 commit 82c1c09Copy full SHA for 82c1c09
1 file changed
func/main.sh
@@ -502,9 +502,18 @@ is_alias_format_valid() {
502
is_ip_format_valid() {
503
object_name=${2-ip}
504
ip_regex='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
505
- if ! [[ $1 =~ ^$ip_regex\.$ip_regex\.$ip_regex\.$ip_regex$ ]]; then
+ ip_clean=$(echo "${1%/[0-9][0-9]}")
506
+ ip_clean=$(echo "${1%/[0-9]}")
507
+ if ! [[ $ip_clean =~ ^$ip_regex\.$ip_regex\.$ip_regex\.$ip_regex$ ]]; then
508
check_result $E_INVALID "invalid $object_name format :: $1"
509
fi
510
+ if [ $1 != "$ip_clean" ]; then
511
+ ip_cidr="$ip_clean/"
512
+ ip_cidr=$(echo "${1#$ip_cidr}")
513
+ if [[ "$ip_cidr" -gt 32 ]]; then
514
+ check_result $E_INVALID "invalid $object_name format :: $1"
515
+ fi
516
517
}
518
519
# Proxy extention format validator
0 commit comments