Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-25 16:04:01 +00:00
parent 81aafbc083
commit 6a2cbdffd0
3 changed files with 97 additions and 0 deletions
+18
View File
@@ -39,6 +39,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.syncRingConfig(0)
}
func (m *Machine) getPeerByName(name string) (*Machine, bool) {
return m.zone.zones.GetMachineByName(name)
}