|
|
|
@ -3,6 +3,7 @@ package zones
|
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
"net/netip" |
|
|
|
|
"strconv" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
@ -26,6 +27,10 @@ func (m *Machine) updatePublicAddresses() error {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Machine) init() error { |
|
|
|
|
if err := m.setID(); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i < RingsCount; i++ { |
|
|
|
|
if err := m.tryReadWireguardKeys(i); err != nil { |
|
|
|
|
return err |
|
|
|
@ -34,6 +39,19 @@ func (m *Machine) init() error {
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Machine) setID() error { |
|
|
|
|
zoneName := m.zone.Name |
|
|
|
|
suffix := m.Name[len(zoneName)+1:] |
|
|
|
|
|
|
|
|
|
id, err := strconv.ParseInt(suffix, 10, 8) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
m.ID = int(id) |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Machine) scan() error { |
|
|
|
|
for i := 0; i < RingsCount; i++ { |
|
|
|
|
if err := m.tryApplyWireguardConfig(i); err != nil { |
|
|
|
|