add validators from wgborg
This commit is contained in:
parent
da7ea0796a
commit
ee4bd1a47f
18
types.go
18
types.go
@ -13,16 +13,16 @@ const DefaultListenPort = 51820;
|
|||||||
// see https://github.com/WireGuard/wgctrl-go/blob/master/wgtypes/types.go for definitions
|
// see https://github.com/WireGuard/wgctrl-go/blob/master/wgtypes/types.go for definitions
|
||||||
type PeerConfig struct {
|
type PeerConfig struct {
|
||||||
// username of person running this host/router
|
// username of person running this host/router
|
||||||
Owner string
|
Owner string `validate:"required,gte=1,lte=255"`
|
||||||
// Used to update DNS
|
// Used to update DNS
|
||||||
Hostname string
|
Hostname string `validate:"required,gte=1,lte=255"`
|
||||||
// Description of what the host is and/or does
|
// Description of what the host is and/or does
|
||||||
Description string
|
Description string `validate:"required,gte=1,lte=255"`
|
||||||
|
|
||||||
PublicKey wgtypes.Key
|
PublicKey wgtypes.Key `validate:"required,len=44"`
|
||||||
PresharedKey wgtypes.Key
|
PresharedKey wgtypes.Key `validate:"required,len=44"`
|
||||||
Endpoint *net.UDPAddr
|
Endpoint *net.UDPAddr `validate:"required,udp4_addr"`
|
||||||
AllowedIPs []net.IPNet
|
AllowedIPs []net.IPNet `validate:"dive,required,cidr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Peer struct {
|
type Peer struct {
|
||||||
@ -47,8 +47,8 @@ type Peer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DsnetConfig struct {
|
type DsnetConfig struct {
|
||||||
PrivateKey *wgtypes.Key
|
PrivateKey *wgtypes.Key `validate:"required,len=44"`
|
||||||
ListenPort *int
|
ListenPort *int `validate:"gte=1024,lte=65535"`
|
||||||
FirewallMark *int
|
FirewallMark *int
|
||||||
Peers []PeerConfig
|
Peers []PeerConfig
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user