|
|
@ -123,9 +123,9 @@ func (m *Machine) applyWireguardConfig(ring int, wg *wireguard.Config) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Machine) getRingInfo(ring int) (*RingInfo, bool) { |
|
|
|
func (m *Machine) getRingInfo(ring int) (*RingInfo, bool) { |
|
|
|
for _, ri := range m.RingAddresses { |
|
|
|
for _, ri := range m.Rings { |
|
|
|
if ri.Ring == ring { |
|
|
|
if ri.Ring == ring { |
|
|
|
return ri, true |
|
|
|
return ri, ri.Enabled |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -133,10 +133,10 @@ func (m *Machine) getRingInfo(ring int) (*RingInfo, bool) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Machine) applyRingInfo(ring int, new *RingInfo) error { |
|
|
|
func (m *Machine) applyRingInfo(ring int, new *RingInfo) error { |
|
|
|
cur, found := m.getRingInfo(ring) |
|
|
|
cur, _ := m.getRingInfo(ring) |
|
|
|
if !found { |
|
|
|
if cur == nil { |
|
|
|
// first, append
|
|
|
|
// first, append
|
|
|
|
m.RingAddresses = append(m.RingAddresses, new) |
|
|
|
m.Rings = append(m.Rings, new) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|