Compare commits

...

2 Commits

Author SHA1 Message Date
Alejandro Mery 3a586ecaf2 cluster: change wg0.conf to allow ring0/32 and ring1/32 on each peer 5 months ago
Alejandro Mery 8db87c6102 cluster: further remove wg1 support 5 months ago
  1. 11
      pkg/cluster/rings.go
  2. 18
      pkg/cluster/wireguard.go

11
pkg/cluster/rings.go

@ -205,14 +205,11 @@ func (r *Ring) AddPeer(p *Machine) bool {
}
func (r *Ring) setRingZeroAllowedIPs(rp *RingPeer) {
regionID, zoneID, _, _ := r.Decode(rp.Address)
// everyone on ring0 is a gateway to ring1
subnet, _ := rings.RingOnePrefix(regionID, zoneID)
rp.AllowSubnet(subnet)
// peer
// ring0 peer
rp.AllowCIDR(rp.Address, 32)
// everyone on ring0 has a leg on ring1
rp.AllowCIDR(rp.Node.RingOneAddress(), 32)
}
func (r *Ring) setRingOneGatewayAllowedIPs(rp *RingPeer) {

18
pkg/cluster/wireguard.go

@ -82,13 +82,6 @@ func (m *Cluster) WriteWireguardConfig(ring rings.RingID) error {
switch ring {
case rings.RingZeroID:
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:
return ErrInvalidRing(ring)
}
@ -100,8 +93,6 @@ func (z *Zone) WriteWireguardConfig(ring rings.RingID) error {
switch ring {
case rings.RingZeroID:
return writeWireguardConfig(z.zones, z.zones, ring)
case rings.RingOneID:
return writeWireguardConfig(z.zones, z, ring)
default:
return ErrInvalidRing(ring)
}
@ -165,13 +156,6 @@ func (m *Cluster) SyncWireguardConfig(ring rings.RingID) error {
switch ring {
case rings.RingZeroID:
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:
return ErrInvalidRing(ring)
}
@ -183,8 +167,6 @@ func (z *Zone) SyncWireguardConfig(ring rings.RingID) error {
switch ring {
case rings.RingZeroID:
return syncWireguardConfig(z.zones, z.zones, ring)
case rings.RingOneID:
return syncWireguardConfig(z.zones, z, ring)
default:
return ErrInvalidRing(ring)
}

Loading…
Cancel
Save