mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-06-06 00:37:24 +03:00
Add global setting form
This commit is contained in:
parent
6f8e5cdbca
commit
e99a5ba92b
7 changed files with 240 additions and 1 deletions
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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue