add IPv6 attrs to config + go fmt

This commit is contained in:
Callan Bryant 2020-10-24 20:51:03 +01:00
parent 952cb44110
commit d07d267c78
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
3 changed files with 9 additions and 6 deletions

View File

@ -21,6 +21,7 @@ type PeerConfig struct {
Description string `validate:"required,gte=1,lte=255"`
// Internal VPN IP address. Added to AllowedIPs in server config as a /32
IP net.IP `validate:"required`
IP6 net.IP `validate:"required`
Added time.Time `validate:"required"`
// TODO ExternalIP support (Endpoint)
//ExternalIP net.UDPAddr `validate:"required,udp4_addr"`
@ -41,7 +42,9 @@ type DsnetConfig struct {
// IP network from which to allocate automatic sequential addresses
// Network is chosen randomly when not specified
Network JSONIPNet `validate:"required"`
Network6 JSONIPNet `validate:"required"`
IP net.IP `validate:"required"`
IP6 net.IP `validate:"required"`
DNS net.IP
// extra networks available, will be added to AllowedIPs
Networks []JSONIPNet `validate:"required"`

View File

@ -9,7 +9,7 @@ import (
func check(e error, optMsg ...string) {
if e != nil {
if (len(optMsg) > 0) {
if len(optMsg) > 0 {
ExitFail("%s - %s", e, strings.Join(optMsg, " "))
}
ExitFail("%s", e)