zones: Machine.IsGateway()

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-23 20:04:47 +00:00
parent 0f62ee2e53
commit c81b782b26
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ func getRingZeroGatewayID(z *Zone) int {
firstNodeID = p.ID
}
if _, ok := p.getRingInfo(0); ok {
if p.IsGateway() {
gatewayID = p.ID
}
+6
View File
@@ -58,6 +58,12 @@ func (m *Machine) getFilename(name string, args ...any) string {
return filepath.Join(s...)
}
// IsGateway tells if the Machine is a ring0 gateway
func (m *Machine) IsGateway() bool {
_, ok := m.getRingInfo(0)
return ok
}
func (m *Machine) getPeerByName(name string) (*Machine, bool) {
return m.zone.zones.GetMachineByName(name)
}