Giter Site home page Giter Site logo

dns-preload's Introduction

Quality Gate Status Coverage Maintainability Rating Security Rating Technical Debt Reliability Rating

dns-preload

A simple go based dns cache preloader, also referred to as a pre-fetcher or cache pre-populator.

Soem nameservers have this already available within them, this tool has been written to provide people with a simple tool that allows them to define what is important and get those results cached. More advanced users can use bash, sed, awk etc to do similar.

Why?

With an intermittent satellite connection when the connection is lost the local DNS cache is flushed. When the connection is restablished the high latency on the link causes a slow down for all connections being reestablished. This was an easy way to update the cache asynchronously when the connection is restored which improves usability of the whole system.

It also works well on trains with crappy reception.

Usage

Add an @reboot line to your users crontab so when the host reboots it will run the tool to pre-populate the dns server with the entries that you wish to use.

dns-preload all --config-file=dns-preload.yaml --full --quiet --server=::1

Can be added to crontab as a user crontab -e

@reboot $HOME/dns-preload all --config-file=dns-preload.yaml --full --quiet --server=::1

replace $HOME with where you have placed the executable.

Configuration

An example configuration file can be found at example-config.yaml in the root of the repository.

Alternatively a configuration can be generated and printed to stdout using

dns-preload config

Example:

./dns-preload config
---
query_type:
    cname: []
    hosts: []
    ns: []
    mx: []
    txt: []
    ptr: []

To write this to a file append > config.yaml e.g. ./dns-preload config > config.yaml

Building

Local System

make dns-preload

Linux ARM64

make linux-arm64

Linux ARM32

make linux-arm32

Linux x86-64

make linux-x64

Help

dns-preload --help
Usage: dns-preload <command>

Preload a DNS cache with a list of hostnames from a YAML configuration file.

Flags:
  -h, --help        Show context-sensitive help.
      --delay=0s    How long to wait until the queries are executed

Commands:
  all       preload all of the following types from the configuration file
  cname     preload only the cname entries from the configuration file
  hosts     preload only the hosts entries from the configuration file, this does an A and AAAA lookup
  mx        preload only the mx entries from the configuration file
  ns        preload only the ns entries from the configuration file
  txt       preload only the txt entries from the configuration file
  ptr       preload only the ptr entries from the configuration file
  config    generate an empty configuration file to stdout

Run "dns-preload <command> --help" for more information on a command.

all of the commands above have the same flags.

dns-preload all --help
Usage: dns-preload all --config-file=STRING

preload all of the following types from the configuration file

Flags:
  -h, --help                  Show context-sensitive help.
      --delay=0s              How long to wait until the queries are executed

      --config-file=STRING    The configuration file to read the domain list to query from
      --server="localhost"    The server to query to seed the domain list into
      --port="53"             The port the DNS server listens for requests on
      --workers=1             The number of concurrent goroutines used to query the DNS server (not implemented)
      --mute                  Suppress the preload task output to the console
      --quiet                 Suppress the preload response output to the console
      --full                  For record types that return a Hostname ensure that these are resolved
      --debug                 Debug mode
      --timeout=30s           The timeout for DNS queries to succeed

dns-preload: error: unexpected argument help

dns-preload's People

Contributors

dependabot[bot] avatar jimmystewpot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.