2525026e2d
Signed-off-by: Alejandro Mery <amery@jpi.io>
24 lines
520 B
Go
24 lines
520 B
Go
package zones
|
|
|
|
// SyncWireguardConfig updates all wgN.conf files for the specified
|
|
// ring
|
|
func (z *Zone) SyncWireguardConfig(ring int) error {
|
|
return z.PruneWireguardConfig(ring)
|
|
}
|
|
|
|
// PruneWireguardConfig removes wgN.conf files of machines with
|
|
// the corresponding ring disabled.
|
|
func (z *Zone) PruneWireguardConfig(ring int) error {
|
|
var err error
|
|
|
|
z.ForEachMachine(func(p *Machine) bool {
|
|
_, ok := p.getRingInfo(ring)
|
|
if !ok {
|
|
err = p.RemoveWireguardConfig(ring)
|
|
}
|
|
return err != nil
|
|
})
|
|
|
|
return err
|
|
}
|