|
|
|
@ -43,6 +43,24 @@ func (m *Machine) IsGateway() bool {
|
|
|
|
|
return ok |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SetGateway enables/disables a Machine ring0 integration
|
|
|
|
|
func (m *Machine) SetGateway(enabled bool) error { |
|
|
|
|
ri, found := m.getRingInfo(0) |
|
|
|
|
switch { |
|
|
|
|
case !found && !enabled: |
|
|
|
|
return nil |
|
|
|
|
case !found: |
|
|
|
|
var err error |
|
|
|
|
|
|
|
|
|
if ri, err = m.createRingInfo(0, false); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ri.Enabled = enabled |
|
|
|
|
return m.SyncWireguardConfig(0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Zone indicates the [Zone] this machine belongs to
|
|
|
|
|
func (m *Machine) Zone() int { |
|
|
|
|
return m.zone.ID |
|
|
|
|