Skip to content

Yangshifu1024/dnsforwarder

Repository files navigation

DnsForwarder

GitHub license Join the chat at https://gitter.im/codebear4/dnsforwarder Build Status Go Report Card Github All Releases

A dns forwarder.

  • Resolve with multiple upstreams
  • Caching the record from upstreams
  • Support local hosts files
  • White list support

Getting started

Installation

Build from source

Make sure you have a correctly configured Go installtion first, then:

$ make bootstrap
$ go build
Install with package

Download packages from GitHub releases page.

Configuration

forcetcp: If set it to true, server will use TCP connection with upstreams even the request from client is UDP request.

cache:

  • enable: Enable or disable in-memory cache
  • ttl: Default TTL for cache

loggers:

  • console:
    • enable: Enable or disable console logger
    • level: Log level for console logger
  • file:
    • enable: Enable or disable file logger
    • level: Log level for file logger
    • path: Log file path

timeout:

  • server:
    • read: Timeout for read from clients
    • write: Timeout for write to clients
  • forwarder:
    • read: Timeout for read from upstreams
    • write: Timeout for write to upstreams

host:

  • enable: Resolve with hosts files
  • resolves: Hosts files list

upstreams: List of upstream dns servers

Running

Build from source
$ sudo dnsforwarder
Install from package
$ service dnsforwarder start # upstart
$ systemctl start dnsforwarder #systemd

Testing

$ dig domain.tld @your.server.ip

TODO

  • Cache persistence
  • Packaging
  • Hot-reload