use ExternalIP6 if ExternalIP not available
This commit is contained in:
parent
608dbf176f
commit
5a870dab60
4
add.go
4
add.go
@ -19,7 +19,11 @@ DNS={{ .DsnetConfig.DNS }}
|
||||
[Peer]
|
||||
PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }}
|
||||
PresharedKey={{ .Peer.PresharedKey.Key }}
|
||||
{{ if gt (.DsnetConfig.ExternalIP | len) 0 -}}
|
||||
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
|
||||
{{ else -}}
|
||||
Endpoint={{ .DsnetConfig.ExternalIP6 }}:{{ .DsnetConfig.ListenPort }}
|
||||
{{ end -}}
|
||||
PersistentKeepalive={{ .Keepalive }}
|
||||
{{ with .DsnetConfig.Network -}}
|
||||
AllowedIPs={{ . }}
|
||||
|
@ -36,7 +36,7 @@ type PeerConfig struct {
|
||||
type DsnetConfig struct {
|
||||
// domain to append to hostnames. Relies on separate DNS server for
|
||||
// resolution. Informational only.
|
||||
ExternalIP net.IP `validate:"required"`
|
||||
ExternalIP net.IP
|
||||
ExternalIP6 net.IP
|
||||
ListenPort int `validate:"gte=1024,lte=65535"`
|
||||
Domain string `validate:"required,gte=1,lte=255"`
|
||||
|
Loading…
Reference in New Issue
Block a user