Documentation ¶
Index ¶
- Constants
- type ConnectionMonitor
- func (cm *ConnectionMonitor) Close() error
- func (cm *ConnectionMonitor) LocalAddr() net.Addr
- func (cm *ConnectionMonitor) Read(b []byte) (int, error)
- func (cm *ConnectionMonitor) RemoteAddr() net.Addr
- func (cm *ConnectionMonitor) SetDeadline(t time.Time) error
- func (cm *ConnectionMonitor) SetReadDeadline(t time.Time) error
- func (cm *ConnectionMonitor) SetWriteDeadline(t time.Time) error
- func (cm *ConnectionMonitor) Write(b []byte) (int, error)
- type DNSSECConfig
- type Monitor
- type MonitorType
- type PacketConnectionMonitor
- func (pcm *PacketConnectionMonitor) Close() error
- func (pcm *PacketConnectionMonitor) LocalAddr() net.Addr
- func (pcm *PacketConnectionMonitor) ReadFrom(p []byte) (int, net.Addr, error)
- func (pcm *PacketConnectionMonitor) SetDeadline(t time.Time) error
- func (pcm *PacketConnectionMonitor) SetReadDeadline(t time.Time) error
- func (pcm *PacketConnectionMonitor) SetWriteDeadline(t time.Time) error
- func (pcm *PacketConnectionMonitor) WriteTo(p []byte, addr net.Addr) (int, error)
- type Server
- func (srv *Server) DumpBackendStats()
- func (srv *Server) LogMapAge()
- func (srv *Server) PeriodicDBReload(reloadInt int)
- func (srv *Server) ReloadDB()
- func (srv *Server) Shutdown()
- func (srv *Server) Start() (err error)
- func (srv *Server) ValidateDbKey(dbKey []byte) error
- func (srv *Server) WatchControlDirAndReload()
- func (srv *Server) WatchDBAndReload()
- type ServerConfig
- type TLSConnectionMonitor
- func (cm *TLSConnectionMonitor) Close() error
- func (cm *TLSConnectionMonitor) ConnectionState() tls.ConnectionState
- func (cm *TLSConnectionMonitor) LocalAddr() net.Addr
- func (cm *TLSConnectionMonitor) Read(b []byte) (int, error)
- func (cm *TLSConnectionMonitor) RemoteAddr() net.Addr
- func (cm *TLSConnectionMonitor) SetDeadline(t time.Time) error
- func (cm *TLSConnectionMonitor) SetReadDeadline(t time.Time) error
- func (cm *TLSConnectionMonitor) SetWriteDeadline(t time.Time) error
- func (cm *TLSConnectionMonitor) Write(b []byte) (int, error)
Constants ¶
const ( // DBTimestampDBReadError occurs we cannot read DB. DBTimestampDBReadError = "db.timestamp.db_read_error" // DBTimestampInvalidTXT happens when a/the TXT record is not parseable to int64. DBTimestampInvalidTXT = "db.timestamp.invalid_txt" // DBTimestampKeySearchError means that searching the key itself failed. This is a DB lookup issue, not anything related to the key. DBTimestampKeySearchError = "db.timestamp.key_search_error" // DBTimestampKeyNotFound happens when we did not find the key, or we did not find any valid TXT record. DBTimestampKeyNotFound = "db.timestamp.key_not_found" // DBTimestampNumRun increments on every timestamp lookup. DBTimestampNumRun = "db.timestamp.num_run" // DBTimestamp is the actual key storing the db timestamp value. DBTimestamp = "db.timestamp" // DBFreshness is difference in seconds between db timestamp value and current time DBFreshness = "db.freshness" )
const BackendStatsInterval = 10
BackendStatsInterval is the interval at which we report backend stats, in seconds.
const DBTimestampInterval = 10
DBTimestampInterval is the interval at which we update the DB timestamp, in seconds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionMonitor ¶
type ConnectionMonitor struct {
// contains filtered or unexported fields
}
ConnectionMonitor is a wrapper around `net.Conn` which serves to log per connection metrics.
func NewConnectionMonitor ¶
func NewConnectionMonitor(c net.Conn, transportName MonitorType, s *metrics.Stats) *ConnectionMonitor
NewConnectionMonitor makes a new ConnectionMonitor from `net.Conn`. It also initializes and increments the appropriate counters for the connection.
func (*ConnectionMonitor) Close ¶
func (cm *ConnectionMonitor) Close() error
Close calls `net.Conn.Close` and then increments counters
func (*ConnectionMonitor) LocalAddr ¶
func (cm *ConnectionMonitor) LocalAddr() net.Addr
LocalAddr is a passthrough for `net.Conn.LocalAddr`
func (*ConnectionMonitor) Read ¶
func (cm *ConnectionMonitor) Read(b []byte) (int, error)
Read is a passthrough for `net.Conn.Read`
func (*ConnectionMonitor) RemoteAddr ¶
func (cm *ConnectionMonitor) RemoteAddr() net.Addr
RemoteAddr is a passthrough for `net.Conn.RemoteAddr`
func (*ConnectionMonitor) SetDeadline ¶
func (cm *ConnectionMonitor) SetDeadline(t time.Time) error
SetDeadline is a passthrough for `net.Conn.SetDeadline`
func (*ConnectionMonitor) SetReadDeadline ¶
func (cm *ConnectionMonitor) SetReadDeadline(t time.Time) error
SetReadDeadline is a passthrough for `net.Conn.SetReadDeadline`
func (*ConnectionMonitor) SetWriteDeadline ¶
func (cm *ConnectionMonitor) SetWriteDeadline(t time.Time) error
SetWriteDeadline is a passthrough for `net.Conn.SetWriteDeadline`
type DNSSECConfig ¶
DNSSECConfig contains the zones and keys configs received from command line e.g comma-separated lists.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is a net.Listener that logs and captures socket metrics.
func NewMonitor ¶
NewMonitor creates a Monitor from a net.Listener.
type MonitorType ¶
type MonitorType string
MonitorType is a transport protocol string (e.g., "tcp").
type PacketConnectionMonitor ¶
type PacketConnectionMonitor struct {
// contains filtered or unexported fields
}
PacketConnectionMonitor is a wrapper around `net.PacketConn` which servers to log per request metrics
func NewPacketConnectionMonitor ¶
func NewPacketConnectionMonitor(c net.PacketConn, transportName MonitorType, s *metrics.Stats) *PacketConnectionMonitor
NewPacketConnectionMonitor makes a new PacketConnectionMonitor from `net.PacketConn`. It also initializes and increments the appropriate counters for the connection.
func (*PacketConnectionMonitor) Close ¶
func (pcm *PacketConnectionMonitor) Close() error
Close calls `net.PacketConn.Close` and then increments counters
func (*PacketConnectionMonitor) LocalAddr ¶
func (pcm *PacketConnectionMonitor) LocalAddr() net.Addr
LocalAddr is a passthrough for `net.PacketConn.LocalAddr`
func (*PacketConnectionMonitor) ReadFrom ¶
ReadFrom calls `net.PacketConn.ReadFrom` and increments the counter
func (*PacketConnectionMonitor) SetDeadline ¶
func (pcm *PacketConnectionMonitor) SetDeadline(t time.Time) error
SetDeadline is a passthrough for `net.PacketConn.SetDeadline`
func (*PacketConnectionMonitor) SetReadDeadline ¶
func (pcm *PacketConnectionMonitor) SetReadDeadline(t time.Time) error
SetReadDeadline is a passthrough for `net.PacketConn.SetReadDeadline`
func (*PacketConnectionMonitor) SetWriteDeadline ¶
func (pcm *PacketConnectionMonitor) SetWriteDeadline(t time.Time) error
SetWriteDeadline is a passthrough for `net.PacketConn.SetWriteDeadline`
type Server ¶
type Server struct { // If NotifyStartedFunc is set it is called once the server has started listening. NotifyStartedFunc func() // Wait group which can be used to wait for servers to initialize and start serving. // Client can wait for servers to start by invoking Done() method in NotifyStartedFunc // and wait for WaitGroup ServersStartedWG sync.WaitGroup // contains filtered or unexported fields }
Server collects all of the running servers and the server configurations.
func NewServer ¶
func NewServer(conf ServerConfig, logger dnsserver.Logger, stats stats.Stats, metricsExporter anyMetricsExporter) *Server
NewServer start the server given a server config, a logger and a stat collector
func (*Server) DumpBackendStats ¶
func (srv *Server) DumpBackendStats()
DumpBackendStats reports stats reported by DB backend as server counters
func (*Server) LogMapAge ¶
func (srv *Server) LogMapAge()
LogMapAge will log DB timestamp every `DBTimestampInterval`.
func (*Server) PeriodicDBReload ¶
PeriodicDBReload reloads db map periodically
func (*Server) Shutdown ¶
func (srv *Server) Shutdown()
Shutdown shuts down all the underlying servers and close the DB.
func (*Server) Start ¶
Start iterates through a list of configured IPs, and starts a separate goroutine to handle DNS requests on the protocols enabled in the configuration. Start does not block, and the servers may fail with fatal errors.
func (*Server) ValidateDbKey ¶
ValidateDbKey checks whether record of certain key is in db
func (*Server) WatchControlDirAndReload ¶
func (srv *Server) WatchControlDirAndReload()
WatchControlDirAndReload refreshes the data view on control file signals change
func (*Server) WatchDBAndReload ¶
func (srv *Server) WatchDBAndReload()
WatchDBAndReload refreshes the data view on DB file change
type ServerConfig ¶
type ServerConfig struct { IPAns ipAns Port int MaxUDPSize int TCP bool TLS bool ReusePort int MaxTCPQueries int TCPIdleTimeout time.Duration NumCPU int MaxConcurrency int ReadTimeout time.Duration TLSConfig tlsconfig.TLSConfig HandlerConfig dnsserver.HandlerConfig CacheConfig dnsserver.CacheConfig DBConfig dnsserver.DBConfig WhoamiDomain string RefuseANY bool DNSSECConfig DNSSECConfig NSID bool PrivateInfo bool }
ServerConfig represent the configuration for a given DNS server
func NewServerConfig ¶
func NewServerConfig() (s ServerConfig)
NewServerConfig returns a fully initialized server configuration.
type TLSConnectionMonitor ¶
type TLSConnectionMonitor struct {
// contains filtered or unexported fields
}
TLSConnectionMonitor is a wrapper around `tls.Conn` which serves to log per connection metrics.
func NewTLSConnectionMonitor ¶
func NewTLSConnectionMonitor(c net.Conn, transportName MonitorType, s *metrics.Stats) *TLSConnectionMonitor
NewTLSConnectionMonitor makes a new ConnectionMonitor from `net.Conn`. It also initializes and increments the appropriate counters for the connection.
func (*TLSConnectionMonitor) Close ¶
func (cm *TLSConnectionMonitor) Close() error
Close calls `net.Conn.Close` and then increments counters
func (*TLSConnectionMonitor) ConnectionState ¶
func (cm *TLSConnectionMonitor) ConnectionState() tls.ConnectionState
ConnectionState is a passthrough for `tls.Conn.ConnectionState`
func (*TLSConnectionMonitor) LocalAddr ¶
func (cm *TLSConnectionMonitor) LocalAddr() net.Addr
LocalAddr is a passthrough for `net.Conn.LocalAddr`
func (*TLSConnectionMonitor) Read ¶
func (cm *TLSConnectionMonitor) Read(b []byte) (int, error)
Read is a passthrough for `net.Conn.Read`
func (*TLSConnectionMonitor) RemoteAddr ¶
func (cm *TLSConnectionMonitor) RemoteAddr() net.Addr
RemoteAddr is a passthrough for `net.Conn.RemoteAddr`
func (*TLSConnectionMonitor) SetDeadline ¶
func (cm *TLSConnectionMonitor) SetDeadline(t time.Time) error
SetDeadline is a passthrough for `net.Conn.SetDeadline`
func (*TLSConnectionMonitor) SetReadDeadline ¶
func (cm *TLSConnectionMonitor) SetReadDeadline(t time.Time) error
SetReadDeadline is a passthrough for `net.Conn.SetReadDeadline`
func (*TLSConnectionMonitor) SetWriteDeadline ¶
func (cm *TLSConnectionMonitor) SetWriteDeadline(t time.Time) error
SetWriteDeadline is a passthrough for `net.Conn.SetWriteDeadline`