Documentation ¶
Overview ¶
Package nasello provides a simple DNS proxy server.
It can be used to route DNS queries to different remote servers based on pattern matching on the requested name.
See `config.go` for details about the configuration file format.
Code is inspired by go-dns examples like: https://github.com/miekg/exdns/blob/master/q/q.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
Filters []configFilter
}
Configuration objects hold the routing configuration for nasello. The configuration file is a JSON file with a simple structure; the following configuration specify 3 forwarders: *.example.com and 10.1.2.* will be resolved by OpenDNS and a catch-all for resolving with Google DNS.
{ "filters": [ { "pattern": "example.com.", "addresses": [ "208.67.222.222", "208.67.220.220" ] }, { "pattern": "2.1.10.in-addr.arpa.", "addresses": [ "208.67.222.222", "208.67.220.220" ] }, { "pattern": ".", "addresses": [ "8.8.8.8" ] } ] }
func ReadConfig ¶
func ReadConfig(filename string) Configuration
ReadConfig reads a JSON file and returns a Configuration object containing the raw elements.
type Handler ¶
type Handler func(dns.ResponseWriter, *dns.Msg)
Handler is the handler function that will serve DNS requests.
func ServerHandler ¶
ServerHandler Returns an anonymous function configured to resolve DNS queries with a specific set of remote servers.