Add some groundwork for implementing rfc5966 recommendations

This commit is contained in:
Miek Gieben 2013-10-18 11:59:19 +00:00
parent 4b1cacf2d2
commit ed0b128bd2
3 changed files with 11 additions and 8 deletions

View File

@ -105,6 +105,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
* 5205 - HIP record
* 5702 - SHA2 in the DNS
* 5936 - AXFR
* 5966 - TCP implementations
* 6605 - ECDSA
* 6742 - ILNP DNS
* 6891 - EDNS0 update

View File

@ -13,6 +13,7 @@ import (
)
const dnsTimeout time.Duration = 2 * 1e9
const tcpIdleTimeout time.Duration = 1 * time.Minute
// A Conn represents a connection to a DNS server.
type Conn struct {

View File

@ -87,7 +87,7 @@ func HandleFailed(w ResponseWriter, r *Msg) {
w.WriteMsg(m)
}
func failedHandler() Handler { return HandlerFunc(HandleFailed) }
func failedHandler() Handler { return HandlerFunc(HandleFailed) }
// Start a server on addresss and network speficied. Invoke handler
// for incoming queries.
@ -189,13 +189,14 @@ func HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) {
// A Server defines parameters for running an DNS server.
type Server struct {
Addr string // address to listen on, ":dns" if empty
Net string // if "tcp" it will invoke a TCP listener, otherwise an UDP one
Handler Handler // handler to invoke, dns.DefaultServeMux if nil
UDPSize int // default buffer size to use to read incoming UDP messages
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>
Addr string // address to listen on, ":dns" if empty
Net string // if "tcp" it will invoke a TCP listener, otherwise an UDP one
Handler Handler // handler to invoke, dns.DefaultServeMux if nil
UDPSize int // default buffer size to use to read incoming UDP messages
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>
IdleTimeout func() time.Duration // TCP idle timeout, see RFC 5966, if nil, default to 1 time.Minute
}
// ListenAndServe starts a nameserver on the configured address in *Server.