Update patch to use the new ExternalHost feature.

This commit is contained in:
axelsimon 2020-12-01 18:54:39 +00:00
parent d699862962
commit 66a7dff5e9

8
add.go
View File

@ -66,7 +66,7 @@ commit; save
`
const nixosPeerConf = `networking.wireguard.interfaces = {{ "{" }}
{{ .Wgif }} = {{ "{" }}
dsnet = {{ "{" }}
ips = [
{{ if gt (.DsnetConfig.Network.IPNet.IP | len) 0 -}}
"{{ .Peer.IP }}/{{ .CidrSize }}"
@ -91,11 +91,7 @@ const nixosPeerConf = `networking.wireguard.interfaces = {{ "{" }}
"{{ .DsnetConfig.Network6 }}"
{{ end -}}
];
{{ if gt (.DsnetConfig.ExternalIP | len) 0 -}}
endpoint = "{{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}";
{{ else -}}
endpoint = "{{ .DsnetConfig.ExternalIP6 }}:{{ .DsnetConfig.ListenPort }}";
{{ end -}}
endpoint = "{{ .Endpoint }}:{{ .DsnetConfig.ListenPort }}";
persistentKeepalive = {{ .Keepalive }};
{{ "}" }}
];