Giter VIP home page Giter VIP logo

udns's Introduction

uDNS

uDNS is a small DNS server that takes in a pre-defined set of domain names and the IPs that each domain name maps to. The mappings should be inputted with a JSON file in a format described below.

uDNS runs on localhost and serves whatever port is specified in the command line arguments. uDNS serves both UDP and TCP connections.

If uDNS does not find the requested domain in the explicitly mapped section of the JSON, uDNS will respond with the IPs given in the otherwise section of the JSON. The otherwise section is mandatory.

JSON format

{
  "mappings": [
    {"domain1": ["ip1", "ip2", "etc"]},
    {"domain2": ["ip3", "ip4", "etc"]},
    {"domain3": ["ip5"]},
  ],

  "otherwise": ["defaultip1", "defaultip2", "etc"]
}

An example can be found in sample_zonefile.json

Caveat

You should not include any two records like this: host1.example.com and example.com

A DNS request for host1.example.com could return the A-record associated with host1.example.com or example.com, depending on your luck.

Running

python3 uDNS.py port zone_file [--rr]

For a detailed description of flags, see python3 uDNS.py -h

Use with Apache Traffic Server

  1. In records.config, add configuration lines: CONFIG proxy.config.dns.nameservers STRING 127.0.0.1:PORT and CONFIG proxy.config.dns.round_robin_nameservers INT 0, where PORT is whatever port you want uDNS to serve on.
  2. Run uDNS on PORT
  3. Now all domains mapped in the uDNS JSON config file should be mapped by ATS as well

udns's People

Contributors

danobi avatar

Watchers

 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.