dnoxy

package module
v0.0.0-...-84f23eb Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

dnoxy

A DNS-over-HTTPS client proxy and server with Cloudflare compatible interfaces, dnoxy (pronounced "d-NOX-y") is a collection of services for running a DNS-over-HTTPS server, and a local network DNS proxy for those servers.

Note: This is proof of concept code, and should not be relied upon for production use. If you're interested in communicating with existing DNS-over-HTTPS servers—such as those run by Cloudflare or Google—you should look at secure-operator.

Right now, dnoxy has two components:

  • dnoxy-http – an HTTP server which implements Cloudflare's DNS-over-HTTPS DNS Wireformat, and looks up answers against plain DNS.
  • dnoxy-dns – a DNS server which can perform lookups against a DNS-over-HTTPS server, such as dnoxy-http or Cloudflare DNS.

A simplified deployment would be:

           dns req                | http req |                 dns req
+--------+         +-----------+  |          |  +------------+         +------------+
| client | ------> | dnoxy-dns | -------------> | dnoxy-http | ------> | dns server |
+--------+         +-----------+  |          |  +------------+         +------------+
        Local Network             | Internet |             Remote Network

Of course, that's no better than current DNS since it's unencrypted, and no caching would be performed; but these services are meant to be no more than building blocks. You would pair dnoxy-dns with a caching DNS server like dnsmasq, and dnoxy-http with an HTTPS terminator proxy like nginx.

Building

Dockerfiles are included for the DNS and HTTP components; to build:

# dns component
docker build -t dnoxy-dns:latest -f Dockerfile-dns
# http component
docker build -t dnoxy-http:latest -f Dockerfile-http

Dependencies are managed with Go 1.11+ modules; to install without Docker:

go mod download
go install -v ./...

License

   Copyright 2019 Nathan Wittstock

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSExchanger

type DNSExchanger struct {
	// contains filtered or unexported fields
}

func NewDNSExchanger

func NewDNSExchanger(addresses []string, opts *DNSExchangerOptions) (*DNSExchanger, error)

func (*DNSExchanger) Exchange

func (d *DNSExchanger) Exchange(ctx context.Context, m *dns.Msg) (r *dns.Msg, err error)

type DNSExchangerOptions

type DNSExchangerOptions struct{}

type DNSHandler

type DNSHandler struct {
	// contains filtered or unexported fields
}

func NewDNSHandler

func NewDNSHandler(ex Exchanger, opts *DNSHandlerOptions) (*DNSHandler, error)

func (*DNSHandler) Handle

func (h *DNSHandler) Handle(w dns.ResponseWriter, r *dns.Msg)

type DNSHandlerOptions

type DNSHandlerOptions struct{}

type Exchanger

type Exchanger interface {
	Exchange(ctx context.Context, m *dns.Msg) (r *dns.Msg, err error)
}

Exchanger is an interface describing a DNS client over any transport.

type HTTPExchanger

type HTTPExchanger struct {
	// contains filtered or unexported fields
}

func NewHTTPExchanger

func NewHTTPExchanger(url string, opts *HTTPExchangerOptions) (*HTTPExchanger, error)

func (*HTTPExchanger) Exchange

func (h *HTTPExchanger) Exchange(ctx context.Context, m *dns.Msg) (*dns.Msg, error)

type HTTPExchangerOptions

type HTTPExchangerOptions struct{}

type HTTPHandler

type HTTPHandler struct {
	// contains filtered or unexported fields
}

func NewHTTPHandler

func NewHTTPHandler(ex Exchanger, opts *HTTPHandlerOptions) (*HTTPHandler, error)

func (*HTTPHandler) ServeHTTP

func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HTTPHandlerOptions

type HTTPHandlerOptions struct{}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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