server

package
v0.0.0-...-94b2ea0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: MIT Imports: 21 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
	Ndots          = 2
)
View Source
const Version = "2.5.3a"

Variables

This section is empty.

Functions

func Fit

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 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 SetDefaults

func SetDefaults(config *Config) error

Types

type Backend

type Backend interface {
	HasSynced() bool
	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"`
	// Round robin selection of nameservers from among those listed, rather than have all forwarded requests try the first listed server first every time.
	NSRotate bool `json:"ns_rotate,omitempty"`
	// List of ip:port, separated 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"`
	// Etcd flag that dictates if etcd version 3 is supported during skydns' run. Default to false.
	Etcd3 bool

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

	Verbose bool `json:"-"`

	Version bool
	// contains filtered or unexported fields
}

Config provides options to the SkyDNS resolver.

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) HasSynced

func (g FirstBackend) HasSynced() bool

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