dns: introduce initial DNS Manager
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -1,2 +1,38 @@
|
||||
// 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user