mirror of
https://github.com/vx3r/wg-gen-web.git
synced 2025-09-11 12:24:27 +00:00
default client allowed ips in server config
This commit is contained in:
@ -16,6 +16,7 @@ type Server struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
Dns []string `json:"dns"`
|
||||
AllowedIPs []string `json:"allowedips"`
|
||||
PreUp string `json:"preUp"`
|
||||
PostUp string `json:"postUp"`
|
||||
PreDown string `json:"preDown"`
|
||||
@ -59,6 +60,12 @@ func (a Server) IsValid() []error {
|
||||
errs = append(errs, fmt.Errorf("dns %s is invalid", dns))
|
||||
}
|
||||
}
|
||||
// check if the allowedIPs are valid
|
||||
for _, allowedIP := range a.AllowedIPs {
|
||||
if !util.IsValidCidr(allowedIP) {
|
||||
errs = append(errs, fmt.Errorf("allowedIP %s is invalid", allowedIP))
|
||||
}
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
Reference in New Issue
Block a user