add IPv6 attrs to config + go fmt
This commit is contained in:
parent
952cb44110
commit
d07d267c78
@ -21,6 +21,7 @@ type PeerConfig struct {
|
|||||||
Description string `validate:"required,gte=1,lte=255"`
|
Description string `validate:"required,gte=1,lte=255"`
|
||||||
// Internal VPN IP address. Added to AllowedIPs in server config as a /32
|
// Internal VPN IP address. Added to AllowedIPs in server config as a /32
|
||||||
IP net.IP `validate:"required`
|
IP net.IP `validate:"required`
|
||||||
|
IP6 net.IP `validate:"required`
|
||||||
Added time.Time `validate:"required"`
|
Added time.Time `validate:"required"`
|
||||||
// TODO ExternalIP support (Endpoint)
|
// TODO ExternalIP support (Endpoint)
|
||||||
//ExternalIP net.UDPAddr `validate:"required,udp4_addr"`
|
//ExternalIP net.UDPAddr `validate:"required,udp4_addr"`
|
||||||
@ -40,9 +41,11 @@ type DsnetConfig struct {
|
|||||||
InterfaceName string `validate:"required,gte=1,lte=255"`
|
InterfaceName string `validate:"required,gte=1,lte=255"`
|
||||||
// IP network from which to allocate automatic sequential addresses
|
// IP network from which to allocate automatic sequential addresses
|
||||||
// Network is chosen randomly when not specified
|
// Network is chosen randomly when not specified
|
||||||
Network JSONIPNet `validate:"required"`
|
Network JSONIPNet `validate:"required"`
|
||||||
IP net.IP `validate:"required"`
|
Network6 JSONIPNet `validate:"required"`
|
||||||
DNS net.IP
|
IP net.IP `validate:"required"`
|
||||||
|
IP6 net.IP `validate:"required"`
|
||||||
|
DNS net.IP
|
||||||
// extra networks available, will be added to AllowedIPs
|
// extra networks available, will be added to AllowedIPs
|
||||||
Networks []JSONIPNet `validate:"required"`
|
Networks []JSONIPNet `validate:"required"`
|
||||||
// TODO Default subnets to route via VPN
|
// TODO Default subnets to route via VPN
|
||||||
@ -127,7 +130,7 @@ func (conf *DsnetConfig) MustRemovePeer(hostname string) {
|
|||||||
|
|
||||||
// remove peer from slice, retaining order
|
// remove peer from slice, retaining order
|
||||||
copy(conf.Peers[peerIndex:], conf.Peers[peerIndex+1:]) // shift left
|
copy(conf.Peers[peerIndex:], conf.Peers[peerIndex+1:]) // shift left
|
||||||
conf.Peers = conf.Peers[:len(conf.Peers)-1] // truncate
|
conf.Peers = conf.Peers[:len(conf.Peers)-1] // truncate
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conf DsnetConfig) IPAllocated(IP net.IP) bool {
|
func (conf DsnetConfig) IPAllocated(IP net.IP) bool {
|
||||||
|
2
const.go
2
const.go
@ -27,7 +27,7 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// populated with LDFLAGS, see do-release.sh
|
// populated with LDFLAGS, see do-release.sh
|
||||||
VERSION = "unknown"
|
VERSION = "unknown"
|
||||||
GIT_COMMIT = "unknown"
|
GIT_COMMIT = "unknown"
|
||||||
BUILD_DATE = "unknown"
|
BUILD_DATE = "unknown"
|
||||||
)
|
)
|
||||||
|
2
util.go
2
util.go
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func check(e error, optMsg ...string) {
|
func check(e error, optMsg ...string) {
|
||||||
if e != nil {
|
if e != nil {
|
||||||
if (len(optMsg) > 0) {
|
if len(optMsg) > 0 {
|
||||||
ExitFail("%s - %s", e, strings.Join(optMsg, " "))
|
ExitFail("%s - %s", e, strings.Join(optMsg, " "))
|
||||||
}
|
}
|
||||||
ExitFail("%s", e)
|
ExitFail("%s", e)
|
||||||
|
Loading…
Reference in New Issue
Block a user