diff --git a/pkg/zones/machine_rings.go b/pkg/zones/machine_rings.go index f5d2915..8085de7 100644 --- a/pkg/zones/machine_rings.go +++ b/pkg/zones/machine_rings.go @@ -157,7 +157,6 @@ func (m *Machine) applyWireguardInterfaceConfig(ring int, data wireguard.Interfa ri := &RingInfo{ Ring: ring, Enabled: true, - Address: data.Address, Keys: &wireguard.KeyPair{ PrivateKey: data.PrivateKey, }, diff --git a/pkg/zones/rings.go b/pkg/zones/rings.go index 763ae84..ac25bd1 100644 --- a/pkg/zones/rings.go +++ b/pkg/zones/rings.go @@ -26,7 +26,6 @@ type RingInfo struct { Ring int `toml:"ring"` Enabled bool `toml:"enabled,omitempty"` Keys *wireguard.KeyPair `toml:"keys,omitempty"` - Address netip.Addr `toml:"address,omitempty"` } // Merge attempts to combine two RingInfo structs @@ -38,9 +37,6 @@ func (ri *RingInfo) Merge(alter *RingInfo) error { case ri.Enabled && !alter.Enabled: // can't disable via Merge return fmt.Errorf("invalid %s: %v → %v", "enabled", ri.Enabled, alter.Enabled) - case !canMergeAddress(ri.Address, alter.Address): - // different address - return fmt.Errorf("invalid %s: %v ≠ %v", "address", ri.Address, alter.Address) case !canMergeKeyPairs(ri.Keys, alter.Keys): // incompatible keypairs return fmt.Errorf("invalid %s: %s ≠ %s", "keys", ri.Keys, alter.Keys) @@ -69,29 +65,9 @@ func (ri *RingInfo) unsafeMerge(alter *RingInfo) error { } } - if addressEqual(ri.Address, netip.Addr{}) { - // assign address - ri.Address = alter.Address - } - return nil } -func canMergeAddress(ip1, ip2 netip.Addr) bool { - var zero netip.Addr - - switch { - case addressEqual(ip1, zero) || addressEqual(ip2, zero) || addressEqual(ip1, ip2): - return true - default: - return false - } -} - -func addressEqual(ip1, ip2 netip.Addr) bool { - return ip1.Compare(ip2) == 0 -} - func canMergeKeyPairs(p1, p2 *wireguard.KeyPair) bool { switch { case p1 == nil || p2 == nil: