wg-portal/internal/wireguard/template.go

24 lines
596 B
Go
Raw Normal View History

2020-11-06 06:21:47 -05:00
package wireguard
var (
ClientCfgTpl = `[Interface]
2020-11-07 05:47:52 -05:00
#{{ .Client.Identifier }}
2020-11-06 06:21:47 -05:00
Address = {{ .Client.IPsStr }}
PrivateKey = {{ .Client.PrivateKey }}
{{ if ne (len .Server.DNS) 0 -}}
DNS = {{ .Server.DNSStr }}
{{- end }}
{{ if ne .Server.Mtu 0 -}}
MTU = {{.Server.Mtu}}
{{- end}}
[Peer]
PublicKey = {{ .Server.PublicKey }}
PresharedKey = {{ .Client.PresharedKey }}
AllowedIPs = {{ .Client.AllowedIPsStr }}
Endpoint = {{ .Server.Endpoint }}
{{ if and (ne .Server.PersistentKeepalive 0) (not .Client.IgnorePersistentKeepalive) -}}
PersistentKeepalive = {{.Server.PersistentKeepalive}}
{{- end}}
`
)