server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package server provides a DNS server implementation that handles DNS queries. To answer a query, the server asks the provided Backend for DNS records, which are then converted to the proper answers.

Index

Constants

View Source
const (
	SCacheCapacity = 10000
	RCacheCapacity = 100000
	RCacheTtl      = 60
)
View Source
const Version = "2.4.0a"

Variables

This section is empty.

Functions

func New

func New(backend Backend, config *Config) *server

New returns a new SkyDNS server.

func ParseKeyFile

func ParseKeyFile(file string) (*dns.DNSKEY, dns.PrivateKey, error)

ParseKeyFile read a DNSSEC keyfile as generated by dnssec-keygen or other utilities. It add ".key" for the public key and ".private" for the private key.

func SetDefaults

func SetDefaults(config *Config) error

Types

type Backend

type Backend interface {
	Records(name string, exact bool) ([]msg.Service, error)
	ReverseRecord(name string) (*msg.Service, error)
}

type Config

type Config struct {
	// The ip:port SkyDNS should be listening on for incoming DNS requests.
	DnsAddr string `json:"dns_addr,omitempty"`
	// bind to port(s) activated by systemd. If set to true, this overrides DnsAddr.
	Systemd bool `json:"systemd,omitempty"`
	// The domain SkyDNS is authoritative for, defaults to skydns.local.
	Domain string `json:"domain,omitempty"`
	// Domain pointing to a key where service info is stored when being queried
	// for local.dns.skydns.local.
	Local string `json:"local,omitempty"`
	// The hostmaster responsible for this domain, defaults to hostmaster.<Domain>.
	Hostmaster string `json:"hostmaster,omitempty"`
	DNSSEC     string `json:"dnssec,omitempty"`
	// Round robin A/AAAA replies. Default is true.
	RoundRobin bool `json:"round_robin,omitempty"`
	// List of ip:port, seperated by commas of recursive nameservers to forward queries to.
	Nameservers []string `json:"nameservers,omitempty"`
	// Never provide a recursive service.
	NoRec       bool          `json:norec,omitempty"`
	ReadTimeout time.Duration `json:"read_timeout,omitempty"`
	// Default priority on SRV records when none is given. Defaults to 10.
	Priority uint16 `json:"priority"`
	// Default TTL, in seconds, when none is given in etcd. Defaults to 3600.
	Ttl uint32 `json:"ttl,omitempty"`
	// Minimum TTL, in seconds, for NXDOMAIN responses. Defaults to 300.
	MinTtl uint32 `json:"min_ttl,omitempty"`
	// SCache, capacity of the signature cache in signatures stored.
	SCache int `json:"scache,omitempty"`
	// RCache, capacity of response cache in resource records stored.
	RCache int `json:"rcache,omitempty"`
	// RCacheTtl, how long to cache in seconds.
	RCacheTtl int `json:"rcache_ttl,omitempty"`
	// How many labels a name should have before we allow forwarding. Default to 2.
	Ndots int `json:"ndot,omitempty"`

	// DNSSEC key material
	PubKey  *dns.DNSKEY    `json:"-"`
	KeyTag  uint16         `json:"-"`
	PrivKey dns.PrivateKey `json:"-"`

	Verbose bool `json:"-"`
	// contains filtered or unexported fields
}

Config provides options to the SkyDNS resolver.

type Counter

type Counter interface {
	Inc(i int64)
}

Counter is the metric interface used by this package

var (
	StatsForwardCount     Counter = nopCounter{}
	StatsStubForwardCount Counter = nopCounter{}
	StatsLookupCount      Counter = nopCounter{}
	StatsRequestCount     Counter = nopCounter{}
	StatsDnssecOkCount    Counter = nopCounter{}
	StatsDnssecCacheMiss  Counter = nopCounter{}
	StatsNameErrorCount   Counter = nopCounter{}
	StatsNoDataCount      Counter = nopCounter{}
)

These are the stat variables defined by this package.

type FirstBackend

type FirstBackend []Backend

FirstBackend exposes the Backend interface over multiple Backends, returning the first Backend that answers the provided record request. If no Backend answers a record request, the last error seen will be returned.

func (FirstBackend) Records

func (g FirstBackend) Records(name string, exact bool) (records []msg.Service, err error)

func (FirstBackend) ReverseRecord

func (g FirstBackend) ReverseRecord(name string) (record *msg.Service, err error)

Jump to

Keyboard shortcuts

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