Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A non-poisonous and CDN-friendly Recursive DNS Resolver

Project description

Build Status Coverage Status

pychinadns

A DNS recursive resolve server to avoid result being poisoned and friendly to CDN. It will qeury dns servers at the same time. You must config at least two dns servers. One is in China and the other is out of China which is not poisoned(tunnel through VPN or use OpenDNS 443/5353 port).

Use the response as follows,

First filter poisoned ip with block iplist with -b argument.
Second,
                           | result is local | result is foreign
     local dns server      |    A            |   B
     foreign dns server    |    C            |   D

AC: use local dns server result
AD: use local dns server result
BC: not possible. use foreign dns server result
BD: use foreign dns server result

Install

$ pip install pychinadns

Usage

$ pychinadns -r chinadns -u 223.5.5.5:53,208.67.222.222:5353 -l debug -f /usr/etc/pychinadns/chnroute.txt -b /usr/etc/pychinadns/iplist.txt

or

$ pychinadns -r chinadns -u 223.5.5.5:53,8.8.8.8:53 -l debug -f /usr/etc/pychinadns/chnroute.txt -b /usr/etc/pychinadns/iplist.txt

Configure

$ pychinadns -r chinadns -h
usage: chinadns.py [-h] [-r HANDLER] [-p PORT] [-u UPSTREAM] [-t TIMEOUT]
                   [-l LOGLEVEL] [-m MODE] -f CHNROUTE -b BLACKLIST
                   [--rfc1918] [--cache]

optional arguments:
  -h, --help
  -r HANDLER, --handler HANDLER
                        Specify handler class, chinadns|quickest (default:
                        None)
  -p PORT, --port PORT  Specify listen port or ip (default: 127.0.0.1:5353)
  -u UPSTREAM, --upstream UPSTREAM
                        Specify multiple upstream dns servers (default:
                        223.5.5.5:53,8.8.8.8:53)
  -t TIMEOUT, --timeout TIMEOUT
                        Specify upstream timeout (default: 1.0)
  -l LOGLEVEL, --log-level LOGLEVEL
                        Specify log level, debug|info|warning|error (default:
                        info)
  -m MODE, --mode MODE  Specify io loop mode, select|epoll (default: select)
  -f CHNROUTE, --chnroute CHNROUTE
                        Specify chnroute file (default: None)
  -b BLACKLIST, --blacklist BLACKLIST
                        Specify ip blacklist file (default: None)
  --rfc1918             Specify if rfc1918 ip is local (default: False)
  --cache               Specify if cache is enabled (default: False)

Acknowledgements

  • @clowwindy: the author of the ChinaDNS

License

This project is under the MIT license. See the LICENSE file for the full license text.

Release history Release notifications

This version
History Node

0.7

History Node

0.6

History Node

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pychinadns-0.7.tar.gz (77.3 kB) Copy SHA256 hash SHA256 Source None Nov 19, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page