mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-07 17:23:14 +03:00
fix private subnets bug
This commit is contained in:
parent
2b7a8d01c7
commit
a89fb34555
5 changed files with 52 additions and 15 deletions
10
util/util.go
10
util/util.go
|
@ -57,7 +57,7 @@ func ValidateCIDR(cidr string) bool {
|
|||
// ValidateCIDRList to validate a list of network CIDR
|
||||
func ValidateCIDRList(cidrs []string) bool {
|
||||
for _, cidr := range cidrs {
|
||||
if ValidateCIDR(cidr) == false {
|
||||
if cidr != "" && ValidateCIDR(cidr) == false {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,14 @@ func ValidateAllowedIPs(cidrs []string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// ValidatePrivateSubnets to validate allowed ip addresses in CIDR format
|
||||
func ValidatePrivateSubnets(cidrs []string) bool {
|
||||
if ValidateCIDRList(cidrs) == false {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// ValidateServerAddresses to validate allowed ip addresses in CIDR format
|
||||
func ValidateServerAddresses(cidrs []string) bool {
|
||||
if ValidateCIDRList(cidrs) == false {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue