diff --git a/pkg/wireguard/config.go b/pkg/wireguard/config.go index f27d5b0..a036b4b 100644 --- a/pkg/wireguard/config.go +++ b/pkg/wireguard/config.go @@ -23,12 +23,16 @@ var configTemplate = template.Must(template.New("config").Funcs(template.FuncMap return strings.Join(s, sep) }, }).Parse(`[Interface] +{{if .Interface.Name}}# Name: {{.Interface.Name}} +{{end -}} Address = {{.Interface.Address}} PrivateKey = {{.Interface.PrivateKey}} ListenPort = {{.Interface.ListenPort}} {{- range .Peer }} [Peer] +{{if .Name}}# Name: {{.Name}} +{{end -}} PublicKey = {{.PublicKey}} Endpoint = {{.Endpoint}} AllowedIPs = {{ PrefixJoin .AllowedIPs ", "}} @@ -64,6 +68,7 @@ func (f *Config) WriteTo(w io.Writer) (int64, error) { // InterfaceConfig represents the [Interface] section type InterfaceConfig struct { + Name string Address netip.Addr PrivateKey PrivateKey ListenPort uint16 @@ -71,6 +76,7 @@ type InterfaceConfig struct { // PeerConfig represents a [Peer] section type PeerConfig struct { + Name string PublicKey PublicKey Endpoint EndpointAddress AllowedIPs []netip.Prefix