|
|
@ -82,13 +82,6 @@ func (m *Cluster) WriteWireguardConfig(ring rings.RingID) error { |
|
|
|
switch ring { |
|
|
|
switch ring { |
|
|
|
case rings.RingZeroID: |
|
|
|
case rings.RingZeroID: |
|
|
|
return writeWireguardConfig(m, m, ring) |
|
|
|
return writeWireguardConfig(m, m, ring) |
|
|
|
case rings.RingOneID: |
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
|
|
m.ForEachZone(func(z *Zone) bool { |
|
|
|
|
|
|
|
err = writeWireguardConfig(m, z, ring) |
|
|
|
|
|
|
|
return err != nil |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
} |
|
|
|
} |
|
|
@ -100,8 +93,6 @@ func (z *Zone) WriteWireguardConfig(ring rings.RingID) error { |
|
|
|
switch ring { |
|
|
|
switch ring { |
|
|
|
case rings.RingZeroID: |
|
|
|
case rings.RingZeroID: |
|
|
|
return writeWireguardConfig(z.zones, z.zones, ring) |
|
|
|
return writeWireguardConfig(z.zones, z.zones, ring) |
|
|
|
case rings.RingOneID: |
|
|
|
|
|
|
|
return writeWireguardConfig(z.zones, z, ring) |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
} |
|
|
|
} |
|
|
@ -165,13 +156,6 @@ func (m *Cluster) SyncWireguardConfig(ring rings.RingID) error { |
|
|
|
switch ring { |
|
|
|
switch ring { |
|
|
|
case rings.RingZeroID: |
|
|
|
case rings.RingZeroID: |
|
|
|
return syncWireguardConfig(m, m, ring) |
|
|
|
return syncWireguardConfig(m, m, ring) |
|
|
|
case rings.RingOneID: |
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
|
|
m.ForEachZone(func(z *Zone) bool { |
|
|
|
|
|
|
|
err = syncWireguardConfig(m, z, ring) |
|
|
|
|
|
|
|
return err != nil |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
} |
|
|
|
} |
|
|
@ -183,8 +167,6 @@ func (z *Zone) SyncWireguardConfig(ring rings.RingID) error { |
|
|
|
switch ring { |
|
|
|
switch ring { |
|
|
|
case rings.RingZeroID: |
|
|
|
case rings.RingZeroID: |
|
|
|
return syncWireguardConfig(z.zones, z.zones, ring) |
|
|
|
return syncWireguardConfig(z.zones, z.zones, ring) |
|
|
|
case rings.RingOneID: |
|
|
|
|
|
|
|
return syncWireguardConfig(z.zones, z, ring) |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
return ErrInvalidRing(ring) |
|
|
|
} |
|
|
|
} |
|
|
|