...also for vyatta

This commit is contained in:
Callan Bryant 2020-10-26 21:39:55 +00:00
parent 5a870dab60
commit 34ff77b27a
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

6
add.go
View File

@ -8,7 +8,7 @@ import (
"time" "time"
) )
const wgQuickPeerConf = `[Interface] const wgQuickPeerConf = `[Interface
Address={{ .Peer.IP }}/22 Address={{ .Peer.IP }}/22
Address={{ .Peer.IP6 }}/64 Address={{ .Peer.IP6 }}/64
PrivateKey={{ .Peer.PrivateKey.Key }} PrivateKey={{ .Peer.PrivateKey.Key }}
@ -46,7 +46,11 @@ set interfaces wireguard wg0 description {{ conf.InterfaceName }}
#set service dns forwarding name-server {{ .DsnetConfig.DNS }} #set service dns forwarding name-server {{ .DsnetConfig.DNS }}
{{ end }} {{ end }}
{{ if gt (.DsnetConfig.ExternalIP | len) 0 -}}
set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} endpoint {{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }} set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} endpoint {{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
{{ else -}}
set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} endpoint {{ .DsnetConfig.ExternalIP6 }}:{{ .DsnetConfig.ListenPort }}
{{ end -}}
set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} persistent-keepalive {{ .Keepalive }} set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} persistent-keepalive {{ .Keepalive }}
set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} preshared-key {{ .Peer.PresharedKey.Key }} set interfaces wireguard wg0 peer {{ .DsnetConfig.PrivateKey.PublicKey.Key }} preshared-key {{ .Peer.PresharedKey.Key }}
{{ with .DsnetConfig.Network -}} {{ with .DsnetConfig.Network -}}