zones

package
v3.0.9+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlwaysWeighted = []uint16{
	dns.TypeA, dns.TypeAAAA, dns.TypeCNAME,
}

AlwaysWeighted types always honors 'MaxHosts', even without an explicit weight set. (This list is slightly arbitrary).

Functions

func NewZoneLabelStats

func NewZoneLabelStats(size int) *zoneLabelStats

Types

type Label

type Label struct {
	Label    string
	MaxHosts int
	Ttl      int
	Records  map[uint16]Records
	Weight   map[uint16]int
	Closest  bool
	Test     *health.HealthTest
}

func (*Label) FirstRR

func (l *Label) FirstRR(dnsType uint16) dns.RR

type LabelMatch

type LabelMatch struct {
	Label *Label
	Type  uint16
}

type MuxManager

type MuxManager struct {
	// contains filtered or unexported fields
}

func NewMuxManager

func NewMuxManager(path string, reg RegistrationAPI) (*MuxManager, error)

func (*MuxManager) Run

func (mm *MuxManager) Run()

func (*MuxManager) Zones

func (mm *MuxManager) Zones() ZoneList

GetZones returns the list of currently active zones in the mux manager. (todo: rename to Zones() when the Zones struct has been renamed to ZoneList)

type NilReg

type NilReg struct{}

func (*NilReg) Add

func (r *NilReg) Add(string, *Zone)

func (*NilReg) Remove

func (r *NilReg) Remove(string)

type Record

type Record struct {
	RR     dns.RR
	Weight int
	Loc    *geo.Location
	Test   *health.HealthTest
}

type Records

type Records []*Record

func (Records) Len

func (s Records) Len() int

func (Records) Swap

func (s Records) Swap(i, j int)

type RecordsByWeight

type RecordsByWeight struct{ Records }

func (RecordsByWeight) Less

func (s RecordsByWeight) Less(i, j int) bool

type RegistrationAPI

type RegistrationAPI interface {
	Add(string, *Zone)
	Remove(string)
}

type Zone

type Zone struct {
	Origin       string
	Labels       labelmap
	LabelCount   int
	Options      ZoneOptions
	Logging      *ZoneLogging
	Metrics      ZoneMetrics
	HasClosest   bool
	HealthStatus health.Status

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewZone

func NewZone(name string) *Zone

func (*Zone) AddLabel

func (z *Zone) AddLabel(k string) *Label

func (*Zone) AddSOA

func (zone *Zone) AddSOA()

func (*Zone) Close

func (z *Zone) Close()

func (*Zone) FindLabels

func (z *Zone) FindLabels(s string, targets []string, qts []uint16) []LabelMatch

Find label "s" in country "cc" falling back to the appropriate continent and the global label name as needed. Looks for the first available qType at each targeting level. Returns a list of LabelMatch for potential labels that might satisfy the query. "MF" records are treated as aliases. The API returns all the matches the targeting will allow so health check filtering won't filter out the "best" results leaving no others.

func (*Zone) HealthRR

func (z *Zone) HealthRR(label string, baseLabel string) []dns.RR

func (*Zone) Picker

func (zone *Zone) Picker(label *Label, qtype uint16, max int, location *geo.Location) Records

Picker picks the best results from a label matching the qtype, up to 'max' results. If location is specified Picker will get return the "closests" results, otherwise they are returned weighted randomized.

func (*Zone) ReadZoneFile

func (zone *Zone) ReadZoneFile(fileName string) (zerr error)

func (*Zone) SetLocations

func (z *Zone) SetLocations()

Find the locations of all the A and AAAA records within a zone. If we were being really clever here we could use LOC records too. But for the time being we'll just use GeoIP.

func (*Zone) SetupMetrics

func (z *Zone) SetupMetrics(old *Zone)

func (*Zone) SoaRR

func (z *Zone) SoaRR() dns.RR

func (*Zone) StartStopHealthTests

func (z *Zone) StartStopHealthTests(start bool, oldZone *Zone)

type ZoneList

type ZoneList map[string]*Zone

ZoneList maps domain names to zone data

type ZoneLogging

type ZoneLogging struct {
	StatHat    bool
	StatHatAPI string
}

type ZoneMetrics

type ZoneMetrics struct {
	LabelStats  *zoneLabelStats
	ClientStats *zoneLabelStats
}

type ZoneOptions

type ZoneOptions struct {
	Serial    int
	Ttl       int
	MaxHosts  int
	Contact   string
	Targeting targeting.TargetOptions
	Closest   bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL