skip to navigation
skip to content

pychinadns 0.7

A non-poisonous and CDN-friendly Recursive DNS Resolver


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.

File Type Py Version Uploaded on Size
pychinadns-0.7.tar.gz (md5) Source 2017-11-19 75KB