dns

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RecordTypeAlias is unusual: the controller will try to resolve the target locally
	RecordTypeAlias = "_alias"

	RecordTypeA     = "A"
	RecordTypeCNAME = "CNAME"
)

Variables

This section is empty.

Functions

func EnsureDotSuffix

func EnsureDotSuffix(s string) string

Types

type Context

type Context interface {
	// CreateScope creates a new scope, which holds a set of records.
	// MarkReady must be called on every scope before any changes will be applied.
	// Records from all the scopes will be merged
	CreateScope(name string) (Scope, error)
}

Context represents a state of the world for DNS. It is grouped by scopes & named keys, and controllers will replace those groups The DNS controller will then merge all those record sets, resolve aliases etc, and then call into a dns backend to match the desired state of the world.

type DNSController

type DNSController struct {
	util.Stoppable
	// contains filtered or unexported fields
}

DNSController applies the desired DNS state to the DNS backend

func NewDNSController

func NewDNSController(provider dnsprovider.Interface, zoneRules *ZoneRules) (*DNSController, error)

NewDnsController creates a DnsController

func (*DNSController) CreateScope

func (c *DNSController) CreateScope(scopeName string) (Scope, error)

CreateScope creates a scope object.

func (*DNSController) Run

func (c *DNSController) Run()

Run starts the DnsController.

type DNSControllerScope

type DNSControllerScope struct {
	// ScopeName is the string id for this scope
	ScopeName string

	// Ready is set if the populating controller has performed an initial synchronization of records
	Ready bool

	// Records is the map of actual records for this scope
	Records map[string][]Record
	// contains filtered or unexported fields
}

scope is a group of record objects

func (*DNSControllerScope) MarkReady

func (s *DNSControllerScope) MarkReady()

func (*DNSControllerScope) Replace

func (s *DNSControllerScope) Replace(recordName string, records []Record)

type Record

type Record struct {
	RecordType RecordType
	FQDN       string
	Value      string

	// If AliasTarget is set, this entry will not actually be set in DNS,
	// but will be used as an expansion for Records with type=RecordTypeAlias,
	// where the referring record has Value = our FQDN
	AliasTarget bool
}

type RecordType

type RecordType string

type Scope

type Scope interface {
	// Replace sets the records for recordName to the provided set of records.
	Replace(recordName string, records []Record)

	// MarkReady should be called when a controller has populated all the records for a particular scope
	MarkReady()
}

type ZoneRules added in v1.4.1

type ZoneRules struct {
	// We don't use a map so we can support e.g. *.example.com later
	Zones    []*ZoneSpec
	Wildcard bool
}

func ParseZoneRules added in v1.4.1

func ParseZoneRules(zones []string) (*ZoneRules, error)

func (*ZoneRules) MatchesExplicitly added in v1.4.1

func (r *ZoneRules) MatchesExplicitly(zone dnsprovider.Zone) bool

MatchesExplicitly returns true if this matches an explicit rule (not a wildcard)

type ZoneSpec added in v1.4.1

type ZoneSpec struct {
	Name string
	ID   string
}

func ParseZoneSpec added in v1.4.1

func ParseZoneSpec(s string) (*ZoneSpec, error)

Jump to

Keyboard shortcuts

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