f5ea72740c
Signed-off-by: Alejandro Mery <amery@jpi.io>
39 lines
544 B
Go
39 lines
544 B
Go
// Package dns manages DNS entries for the cluster
|
|
package dns
|
|
|
|
import (
|
|
"fmt"
|
|
"net/netip"
|
|
)
|
|
|
|
// Zone represents a set of hosts with high affinity
|
|
type Zone struct {
|
|
Name string
|
|
|
|
Hosts map[int]*Host
|
|
}
|
|
|
|
func (z *Zone) String() string {
|
|
if z == nil {
|
|
return "undetermined"
|
|
}
|
|
return z.Name
|
|
}
|
|
|
|
// Host represents a member of the cluster
|
|
type Host struct {
|
|
zone *Zone
|
|
|
|
ID int
|
|
Active bool
|
|
Addrs []netip.Addr
|
|
}
|
|
|
|
func (p *Host) String() string {
|
|
if p == nil {
|
|
return "undetermined"
|
|
}
|
|
|
|
return fmt.Sprintf("%s-%v", p.zone, p.ID)
|
|
}
|