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]
|
[Peer]
|
||||||
PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }}
|
PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }}
|
||||||
PresharedKey={{ .Peer.PresharedKey.Key }}
|
PresharedKey={{ .Peer.PresharedKey.Key }}
|
||||||
|
{{ if gt (.DsnetConfig.ExternalIP | len) 0 -}}
|
||||||
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
|
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
|
||||||
|
{{ else -}}
|
||||||
|
Endpoint={{ .DsnetConfig.ExternalIP6 }}:{{ .DsnetConfig.ListenPort }}
|
||||||
|
{{ end -}}
|
||||||
PersistentKeepalive={{ .Keepalive }}
|
PersistentKeepalive={{ .Keepalive }}
|
||||||
{{ with .DsnetConfig.Network -}}
|
{{ with .DsnetConfig.Network -}}
|
||||||
AllowedIPs={{ . }}
|
AllowedIPs={{ . }}
|
||||||
|
@ -36,7 +36,7 @@ type PeerConfig struct {
|
|||||||
type DsnetConfig struct {
|
type DsnetConfig struct {
|
||||||
// domain to append to hostnames. Relies on separate DNS server for
|
// domain to append to hostnames. Relies on separate DNS server for
|
||||||
// resolution. Informational only.
|
// resolution. Informational only.
|
||||||
ExternalIP net.IP `validate:"required"`
|
ExternalIP net.IP
|
||||||
ExternalIP6 net.IP
|
ExternalIP6 net.IP
|
||||||
ListenPort int `validate:"gte=1024,lte=65535"`
|
ListenPort int `validate:"gte=1024,lte=65535"`
|
||||||
Domain string `validate:"required,gte=1,lte=255"`
|
Domain string `validate:"required,gte=1,lte=255"`
|
||||||
|
Loading…
Reference in New Issue
Block a user