Browse Source

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

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head v0.4.9
Alejandro Mery 10 months ago
parent
commit
acf9e0e81d
  1. 2
      pkg/zones/rings.go

2
pkg/zones/rings.go

@ -210,6 +210,7 @@ func (r *Ring) AddPeer(p *Machine) bool {
Address: addr, Address: addr,
PrivateKey: ri.Keys.PrivateKey, PrivateKey: ri.Keys.PrivateKey,
PeerConfig: wireguard.PeerConfig{ PeerConfig: wireguard.PeerConfig{
Name: fmt.Sprintf("%s-%v", p.Name, r.ID),
PublicKey: ri.Keys.PublicKey, PublicKey: ri.Keys.PublicKey,
Endpoint: wireguard.EndpointAddress{ Endpoint: wireguard.EndpointAddress{
Host: p.FullName(), Host: p.FullName(),
@ -300,6 +301,7 @@ func (r *Ring) ExportConfig(p *Machine) (*wireguard.Config, error) {
case pp.Node == p: case pp.Node == p:
// current // current
found = true found = true
out.Interface.Name = pp.PeerConfig.Name
out.Interface.Address = pp.Address out.Interface.Address = pp.Address
out.Interface.PrivateKey = pp.PrivateKey out.Interface.PrivateKey = pp.PrivateKey
default: default:

Loading…
Cancel
Save