dns: introduce initial DNS Manager

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-09-12 15:11:19 +00:00
parent 357c85dc1a
commit f5ea72740c
4 changed files with 290 additions and 1 deletions
+36
View File
@@ -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)
}