Documentation
¶
Index ¶
- func CheckConfig(config *Config) error
- func CreateListenAddress(listen string) (string, error)
- func CreateNameservers(servers []string) ([]string, error)
- func CreateSearchDomains(domains []string) ([]string, error)
- func CreateStubMap(stubzones []string) (map[string][]string, error)
- func Fit(m *dns.Msg, size int, tcp bool) (*dns.Msg, bool)
- func ResolvConf(config *Config, forceNdots bool) error
- type Config
- type Counter
- type Hostfile
- type PluggableFunc
- type Server
- func (s *Server) AddressRecords(q dns.Question, name string) (records []dns.RR, err error)
- func (s *Server) PTRRecords(q dns.Question) (records []dns.RR, err error)
- func (s *Server) RoundRobin(rrs []dns.RR)
- func (s *Server) Run(ctx context.Context) error
- func (s *Server) ServeDNS(w dns.ResponseWriter, req *dns.Msg)
- func (s *Server) ServeDNSForward(w dns.ResponseWriter, req *dns.Msg) *dns.Msg
- func (s *Server) ServeDNSReverse(w dns.ResponseWriter, req *dns.Msg) *dns.Msg
- func (s *Server) ServerFailure(m, req *dns.Msg)
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Hijack()
- func (w *Writer) Internal() bool
- func (w *Writer) LocalAddr() net.Addr
- func (w *Writer) Msg() *dns.Msg
- func (w *Writer) Proto() string
- func (w *Writer) Rcode() int
- func (w *Writer) RemoteAddr() net.Addr
- func (w *Writer) RemoteIP() net.IP
- func (w *Writer) Reset(rw dns.ResponseWriter)
- func (w *Writer) TsigStatus() error
- func (w *Writer) TsigTimersOnly(ok bool)
- func (w *Writer) Write(b []byte) (int, error)
- func (w *Writer) WriteMsg(msg *dns.Msg) error
- func (w *Writer) Written() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConfig ¶
func CreateListenAddress ¶
func CreateNameservers ¶
func CreateSearchDomains ¶
func Fit ¶
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 ResolvConf ¶
Types ¶
type Config ¶
type Config struct { // The ip:port go-dnsmasq 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"` // Rewrite host's network config making go-dnsmasq the default resolver DefaultResolver bool `json:"default_resolver,omitempty"` // Search domains used to qualify queries SearchDomains []string `json:"search_domains,omitempty"` // Replicates GNU libc's use of /etc/resolv.conf search domains EnableSearch bool `json:"append_domain,omitempty"` // Path to the hostfile Hostsfile string `json:"hostfile,omitempty"` // Path to the directory of hostfiles DirectoryHostsfiles string `json:"directory_hostsfiles,omitempty"` // Hostfile Polling PollInterval time.Duration `json:"poll_interval,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 TTL, in seconds. Defaults to 360. Ttl uint32 `json:"ttl,omitempty"` // Default TTL for Hostfile records, in seconds. Defaults to 30. HostsTtl uint32 `json:"hostfile_ttl,omitempty"` // RCache, capacity of response cache in resource records stored. RCache int `json:"rcache,omitempty"` // RCacheTtl, how long to cache in seconds. RCacheTtl time.Duration `json:"rcache_ttl,omitempty"` // How many dots a name must have before we allow to forward the query as-is. Defaults to 1. FwdNdots int `json:"fwd_ndots,omitempty"` // How many dots a name must have before we do an initial absolute query. Defaults to 1. Ndots int `json:"ndots,omitempty"` Verbose bool `json:"-"` // Stub zones support. Map contains domainname -> nameserver:port Stub map[string][]string }
Config provides options to the go-dnsmasq 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{} StatsCacheMiss Counter = nopCounter{} StatsCacheHit Counter = nopCounter{} )
type PluggableFunc ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(hostfile Hostfile, config *Config, v string, f *PluggableFunc) *Server
New returns a new Server.
func (*Server) AddressRecords ¶
func (*Server) PTRRecords ¶
func (*Server) RoundRobin ¶
func (*Server) ServeDNSForward ¶
ServeDNSForward resolves a query by forwarding to a recursive nameserver
func (*Server) ServeDNSReverse ¶
ServeDNSReverse is the handler for DNS requests for the reverse zone. If nothing is found locally the request is forwarded to the forwarder for resolution.