server

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0 Imports: 19 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.5.2d"

Variables

This section is empty.

Functions

func Fit added in v1.0.7

func Fit(m *dns.Msg, size int, tcp bool) (*dns.Msg, bool)

Fit will make m fit the size. If a message is larger than size then entire additional section is dropped. If it is still to large and the transport is udp we return a truncated message. If the transport is tcp we are going to drop RR from the answer section until it fits. When this is case the returned bool is true.

func Metrics added in v1.0.2

func Metrics()

Metrics registers the DNS metrics to Prometheus, and starts the internal metrics server if the environment variable PROMETHEUS_PORT is set.

func New

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

New returns a new SkyDNS server.

func ParseKeyFile

func ParseKeyFile(file string) (*dns.DNSKEY, crypto.Signer, 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 RegisterMetrics added in v1.0.5

func RegisterMetrics(prometheusNamespace, prometheusSubsystem string)

RegisterMetrics registers DNS specific Prometheus metrics with the provided namespace and subsystem.

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"`
	// The network used to bind DNS - can be 'ip' (both ipv4 and ipv6), 'ipv4', or 'ipv6', defaults to 'ip'
	BindNetwork string `json:"bind_network,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:"no_rec,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 crypto.Signer `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{}
	StatsNameErrorCount   Counter = nopCounter{}
	StatsNoDataCount      Counter = nopCounter{}

	StatsDnssecCacheMiss Counter = nopCounter{}
)

These are the old stat variables defined by this package. This used by graphite.

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