zones: extend WriteWireguardConfig to include a Name indicating the ring ID

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-26 18:26:11 +00:00
parent 3b43e0c9ea
commit a13a7debb4
+2
View File
@@ -210,6 +210,7 @@ func (r *Ring) AddPeer(p *Machine) bool {
Address: addr,
PrivateKey: ri.Keys.PrivateKey,
PeerConfig: wireguard.PeerConfig{
Name: fmt.Sprintf("%s-%v", p.Name, r.ID),
PublicKey: ri.Keys.PublicKey,
Endpoint: wireguard.EndpointAddress{
Host: p.FullName(),
@@ -300,6 +301,7 @@ func (r *Ring) ExportConfig(p *Machine) (*wireguard.Config, error) {
case pp.Node == p:
// current
found = true
out.Interface.Name = pp.PeerConfig.Name
out.Interface.Address = pp.Address
out.Interface.PrivateKey = pp.PrivateKey
default: