Giter Site home page Giter Site logo

simpledns's Introduction

SimpleDNS

image

A lightweight yet useful proxy DNS server designed to cope with complicated Internet environment in China, inspired by ChinaDNS , dnsmasq-chinadns and fqdns, powered by Python Twisted.

Requirement

  • Python 2.7
  • Twisted
  • Tornado for using Tornado IOLoop(optional)

Install

  • Linux/Mac OS X:

    # Clone this project
    $ sudo python setup.py install
  • Windows

    Download

Usage

Run sudo simpledns on your local machine. Then set your DNS server to 127.0.0.1.

$ dig www.twitter.com +short
twitter.com.
199.59.149.230
199.59.148.10
199.59.150.7
199.59.150.39

Note that the default cache lifetime depends on the ttl of DNS answer. You may want to set a larger ttl using --min-ttl to extend the cache lifetime.

Advanced

$ simpledns -h
usage: simpledns [-h] [-b BIND_ADDR] [-p BIND_PORT]
                 [--upstream-ip UPSTREAM_IP] [--upstream-port UPSTREAM_PORT]
                 [--query-timeout QUERY_TIMEOUT] [--min-ttl MIN_TTL]
                 [--max-ttl MAX_TTL] [--cache-size CACHE_SIZE] [-t]
                 [--hosts-file HOSTS_FILE] [--dispatch-conf DISPATCH_CONF]
                 [-v {0,1,2}] [-q] [-V]

A lightweight yet useful proxy DNS server

optional arguments:
  -h, --help            show this help message and exit
  -b BIND_ADDR, --bind-addr BIND_ADDR
                        local address to listen
  -p BIND_PORT, --bind-port BIND_PORT
                        local port to listen
  --upstream-ip UPSTREAM_IP
                        upstream DNS server ip address
  --upstream-port UPSTREAM_PORT
                        upstream DNS server port
  --query-timeout QUERY_TIMEOUT
                        time before close port used for querying
  --min-ttl MIN_TTL     the minimum time a record is held in cache
  --max-ttl MAX_TTL     the maximum time a record is held in cache
  --cache-size CACHE_SIZE
                        record cache size
  -t, --tcp-server      enables TCP serving
  --hosts-file HOSTS_FILE
                        hosts file
  --dispatch-conf DISPATCH_CONF
                        URL dispatch conf file
  -v {0,1,2}, --verbosity {0,1,2}
                        output verbosity
  -q, --quiet           disable output
  -V, --version         print version number and exit

Configuration

Configuration file is at /usr/local/etc/simpledns/dispatch.conf.

Dispatch conf file uses the same rule as in Dnsmasq. 'Address' and 'Server' rules are supported.

address=/example1.com/1.1.1.1
server=/example2.com/1.1.1.2

Default dispatch conf file is from dnsmasq-china-list.

Fake ip list file is at /usr/local/ect/simpledns/iplist/txt. The source is ChinaDNS.

TODO

  • Config file support
  • EDNS support
  • Negative caching

License

The MIT License

simpledns's People

Contributors

skyline75489 avatar

Watchers

pproxy 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.