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


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


$ pip install pychinadns


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


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


$ pychinadns -r chinadns -h
usage: [-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:
  -p PORT, --port PORT  Specify listen port or ip (default:
  -u UPSTREAM, --upstream UPSTREAM
                        Specify multiple upstream dns servers (default:
  -t TIMEOUT, --timeout TIMEOUT
                        Specify upstream timeout (default: 1.0)
  -l LOGLEVEL, --log-level LOGLEVEL
                        Specify log level, debug|info|warning|error (default:
  -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)


  • @clowwindy: the author of the ChinaDNS


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

Release history Release notifications

This version
History Node


History Node


History Node


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