You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// 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)
|
|
|
|
}
|