nasello

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 8 Imported by: 0

README

nasello

A very simple DNS proxy server capable of routing client queries to different remote servers based on pattern matching.

This software relies heavily on miekg's excellent DNS library.

Warning: this is alpha software and should be used with caution.

Getting Started

Getting nasello

The latest release is available at Github

Installing from source

You can install nasello with the standard go get:

go install github.com/piger/nasello/cmd/nasello

This command will install a copy of nasello inside $GOPATH/bin/.

Configuration format

The configuration file is a JSON document which must contains a filters list with one or more pattern dictionaries; each filter must contain a FQDN DNS name as the pattern and a list of one or more remote DNS servers to forward the query to. For reverse lookups the in-addr.arpa domain must be used in the pattern definition.

To use DNS-over-HTTPS see the example below.

The "." pattern specifies a default remote resolver.

Example

The following configuration example specifies three filters:

  • *.example.com will be resolved by OpenDNS (208.67.222.222, etc.)
  • 10.0.24.* will also be resolved by OpenDNS
  • all the other queries will be forwarded to Google DNS (8.8.8.8, etc.)

nasello.json:

{
  "filters": [
    {
      "pattern": "example.com.",
      "addresses": [ "208.67.222.222", "208.67.220.220" ]
    },
    {
      "pattern": "25.1.10.in-addr.arpa.",
      "addresses": [ "10.1.25.1", "10.1.25.2" ]
    },
    {
      "pattern": "google.com.",
      "addresses": [ "8.8.8.8", "8.8.4.4" ]
    },
    {
      "pattern": ".",
      "addresses": [ "1.1.1.1:853" ],
      "protocol": "tcp-tls"
    }
  ]
}

License

nasello is under the MIT license. See the LICENSE file for details.

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

func ServerHandler(addresses []string, protocol string) Handler

ServerHandler Returns an anonymous function configured to resolve DNS queries with a specific set of remote servers.

Directories

Path Synopsis
cmd
nasello
Nasello is a DNS proxy server
Nasello is a DNS proxy server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL