mirror of
https://github.com/swissmakers/wireguard-manager.git
synced 2026-04-11 13:47:05 +02:00
Add global setting form
This commit is contained in:
18
util/util.go
18
util/util.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user