Add global setting form

This commit is contained in:
Khanh Ngo 2020-04-20 09:54:41 +07:00
parent 6f8e5cdbca
commit e99a5ba92b
No known key found for this signature in database
GPG key ID: D5FAA6A16150E49E
7 changed files with 240 additions and 1 deletions

View file

@ -74,3 +74,21 @@ func ValidateServerAddresses(cidrs []string) bool {
}
return true
}
// ValidateIPAddress to validate the IPv4 and IPv6 address
func ValidateIPAddress(ip string) bool {
if net.ParseIP(ip) == nil {
return false
}
return true
}
// ValidateIPAddressList to validate a list of IPv4 and IPv6 addresses
func ValidateIPAddressList(ips []string) bool {
for _, ip := range ips {
if ValidateIPAddress(ip) == false {
return false
}
}
return true
}