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

10
add.go
View File

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