translator

package module
v0.0.0-...-7341ef1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

DNS-over-HTTPs-translator

HTTP proxy server that accepts DNS queries and responds with replies from the configured DNS resolver.

License

Apache License 2.0

Working

The DoH-Translator listens on port 80 and translates GET or POST requests containing messages of media type - "application/dns-message". The translator then queries the configured DNS Resolver (default is the public anycast Comcast DNS Resolver) and correlates the DNS response from the resolver with the HTTP exchange.

Design

The DoH-Translator uses the following interfaces: Config, Controller and Proxy. This keeps the design modular and allows for more functionality to be added by adding features to the interface implementation. The current Proxy interface is implemented using the net/http go package. Proxy can also be implemented using a different http package if desired.

Configuration

The translator is configured using the config-doh-translator.yaml file at the path /etc/translator on a linux machine.

Since the translator is designed to be hosted behind an nginx HTTPS service and within a provider's network, the resolver's IP could be appropriately chosen to be the geographically closest internal resolver. For now the public anycast Comcast DNS IP is set as default.

Example:

# IP address and port of the resolver.
# Note: Comcast resolver set as default if no resolver
#       is provided here.
resolver: "75.75.75.75:53"

# Other configuration options such as caching options, rate-limiting
# options go below this. (TBD)

Requirements

Please verify the success of the below checks before executing the translator:

  • echo $GOPATH must be set as a system-wide environment variable.

Execution

mkdir -p /etc/translator/
mkdir -p $GOPATH/src/github.com/Comcast
cd $GOPATH/src/github.com/Comcast
git clone git@github.com:Comcast/DNS-over-HTTPs-translator.git
cd translator
cp $GOPATH/src/github.com/Comcast/DNS-over-HTTPs-translator/config-doh-translator.yaml /etc/translator
make build
sudo .build/doh-translator-linux-amd64 start

Note: To exit to terminal or stop translator, hit Ctrl + C twice.

Deploy

# Run script to deploy the translator as a systemd service (sudo commands used)
sh deploy.sh

# To start service...
sudo service doh-translator start

# To check status of service...
sudo service doh-translator status

# To stop service...
sudo service doh-translator stop

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Resolver() string
	Listen() string
	Logger() (logger *zap.Logger, err error)
}

type Controller

type Controller interface {
	Start(ctx context.Context) (err error)
	Proxy() Proxy
}

type Proxy

type Proxy interface {
	Start(ctx context.Context) (err error)
	Stop() (err error)
}

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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