{"id":13440404,"url":"https://github.com/shadowsocks/ChinaDNS","last_synced_at":"2025-03-20T09:33:04.461Z","repository":{"id":18979837,"uuid":"22201118","full_name":"shadowsocks/ChinaDNS","owner":"shadowsocks","description":"Protect yourself against DNS poisoning in China.","archived":false,"fork":false,"pushed_at":"2020-05-03T10:00:17.000Z","size":1241,"stargazers_count":3604,"open_issues_count":44,"forks_count":1279,"subscribers_count":245,"default_branch":"master","last_synced_at":"2025-03-16T12:06:46.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shadowsocks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-24T06:06:44.000Z","updated_at":"2025-03-16T00:26:53.000Z","dependencies_parsed_at":"2022-08-07T09:01:03.453Z","dependency_job_id":null,"html_url":"https://github.com/shadowsocks/ChinaDNS","commit_stats":null,"previous_names":["clowwindy/chinadns"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2FChinaDNS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2FChinaDNS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2FChinaDNS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowsocks%2FChinaDNS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowsocks","download_url":"https://codeload.github.com/shadowsocks/ChinaDNS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244586023,"owners_count":20476860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:22.470Z","updated_at":"2025-03-20T09:33:04.127Z","avatar_url":"https://github.com/shadowsocks.png","language":"C","funding_links":[],"categories":["C","Categories"],"sub_categories":["Firewall analysis"],"readme":"ChinaDNS\n========\n\n[![Build Status]][Travis CI]\n[![Coverage Status]][Coverage]\n\nTraditional way to bypass DNS poisoning is to send all queries to\na foreign DNS server via VPN. However some Chinese websites will get\nbad results if they have CDNs outside the country.\n\nThe second way is to maintain a list of domains of which you want to\nresolve from local DNS or foreign DNS. This list changes too often,\ntaking too much effort to maintain.\n\nChinaDNS automatically queries local DNS servers to resolve Chinese domains\nand queries foreign DNS servers to resolve foreign domains. It is smart\nenough to work only with a Chinese IP range file, which doesn't change often.\n\nIn order to bypass IP blocking, you SHOULD use VPN software like [ShadowVPN].\n\nInstall\n-------\n\n* Linux / Unix\n\n    [Download a release].\n\n        ./configure \u0026\u0026 make\n        src/chinadns -m -c chnroute.txt\n\n* OpenWRT\n\n    * [Download precompiled] for OpenWRT trunk and CPU: ar71xx, brcm63xx,\n      brcm47xx, ramips_24kec. Open an issue if you think your CPU is a popular\n      one but not listed here.\n    * If you use other CPU or other OpenWRT versions, build yourself:\n      cd into [SDK] root, then\n\n            pushd package\n            git clone https://github.com/clowwindy/ChinaDNS.git\n            popd\n            make menuconfig # select Network/ChinaDNS\n            make -j\n            make V=99 package/ChinaDNS/openwrt/compile\n\n* Tomoto\n\n    * Download [Tomato toolchain], build by yourself.\n    * Uncompress the downloaded file to `~/`.\n    * Copy the `brcm` directory under\n      `~/WRT54GL-US_v4.30.11_11/tools/` to `/opt`, then\n\n            export PATH=/opt/brcm/hndtools-mipsel-uclibc/bin/:/opt/brcm/hndtools-mipsel-linux/bin/:$PATH\n            git clone https://github.com/clowwindy/ChinaDNS.git\n            cd ChinaDNS\n            ./autogen.sh \u0026\u0026 ./configure --host=mipsel-linux --enable-static \u0026\u0026 make\n\n* Windows\n\n    [Download] Python exe version.\n\nUsage\n-----\n\n* Linux / Unix\n    Recommand using with option \"-m\" ([DNS pointer mutation method])\n    Run `sudo chinadns -m -c chnroute.txt` on your local machine. ChinaDNS creates a\n    UDP DNS Server at `0.0.0.0:53`.\n\n* OpenWRT\n\n        opkg install ChinaDNS_1.x.x_ar71xx.ipk\n        /etc/init.d/chinadns start\n        /etc/init.d/chinadns enable\n\n    Invoke the \"enable\" command to run the initscript on boot\n\n    (Optional) We strongly recommend you to set ChinaDNS as a upstream DNS\n    server for dnsmasq instead of using ChinaDNS directly:\n\n    1. Run `/etc/init.d/chinadns stop`\n    2. Remove the 2 lines containing `iptables` in `/etc/init.d/chinadns`.\n    3. Update `/etc/dnsmasq.conf` to use only 127.0.0.1#5353:\n\n            no-resolv\n            server=127.0.0.1#5353\n\n    4. Restart chinadns and dnsmasq\n\nTest if it works correctly:\n\n    $ dig @192.168.1.1 www.youtube.com -p5353\n    ; \u003c\u003c\u003e\u003e DiG 9.8.3-P1 \u003c\u003c\u003e\u003e @127.0.0.1 www.google.com -p5353\n    ; (1 server found)\n    ;; global options: +cmd\n    ;; Got answer:\n    ;; -\u003e\u003eHEADER\u003c\u003c- opcode: QUERY, status: NOERROR, id: 29845\n    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0\n    \n    ;; QUESTION SECTION:\n    ;www.youtube.com.\t\tIN\tA\n    \n    ;; ANSWER SECTION:\n    www.youtube.com.\t21569\tIN\tCNAME\tyoutube-ui.l.google.com.\n    youtube-ui.l.google.com. 269\tIN\tA\t216.58.220.174\n\n    ;; Query time: 74 msec\n    ;; SERVER: 127.0.0.1#5353(127.0.0.1)\n    ;; WHEN: Fri Jan 30 18:37:57 2015\n    ;; MSG SIZE  rcvd: 83\n\nCurrently ChinaDNS only supports UDP. Builtin OpenWRT init script works with\ndnsmasq, which handles TCP. If you use it directly without dnsmasq, you need to\nadd a redirect rule for TCP:\n\n    iptables -t nat -A PREROUTING -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53\n\nAdvanced\n--------\n\n    usage: chinadns [-h] [-l IPLIST_FILE] [-b BIND_ADDR] [-p BIND_PORT]\n           [-c CHNROUTE_FILE] [-s DNS] [-v]\n    Forward DNS requests.\n\n    -h, --help            show this help message and exit\n    -l IPLIST_FILE        path to ip blacklist file\n    -c CHNROUTE_FILE      path to china route file\n                          if not specified, CHNRoute will be turned off\n    -d                    enable bi-directional CHNRoute filter\n    -y                    delay time for suspects, default: 0.3\n    -b BIND_ADDR          address that listens, default: 127.0.0.1\n    -p BIND_PORT          port that listens, default: 53\n    -s DNS                DNS servers to use, default:\n                          114.114.114.114,208.67.222.222:443,8.8.8.8\n    -m                    Using DNS compression pointer mutation\n                          (backlist and delaying would be disabled)\n    -v                    verbose logging\n\nAbout chnroute\n--------------\n\nYou can generate latest chnroute.txt using this command:\n\n    curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\\| '{ printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' \u003e chnroute.txt\n\n\nLicense\n-------\n\nCopyright (C) 2015 clowwindy\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\nBugs and Issues\n----------------\nPlease visit [Issue Tracker]\n\nMailing list: http://groups.google.com/group/shadowsocks\n\n\n[Build Status]:         https://travis-ci.org/clowwindy/ChinaDNS.svg?branch=master\n[ChinaDNS]:             https://github.com/clowwindy/ChinaDNS\n[Coverage Status]:      https://jenkins.shadowvpn.org/result/chinadns\n[Coverage]:             https://jenkins.shadowvpn.org/job/ChinaDNS/ws/src/index.html\n[Download]:             https://github.com/clowwindy/ChinaDNS/releases\n[Issue Tracker]:        https://github.com/clowwindy/ChinaDNS/issues?state=open\n[Download precompiled]: https://github.com/clowwindy/ChinaDNS/releases\n[Download a release]:   https://github.com/clowwindy/ChinaDNS/releases\n[SDK]:                  http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk\n[ShadowVPN]:            https://github.com/clowwindy/ShadowVPN\n[Tomato toolchain]:     http://downloads.linksysbycisco.com/downloads/WRT54GL_v4.30.11_11_US.tgz\n[Travis CI]:            https://travis-ci.org/clowwindy/ChinaDNS\n[DNS pointer mutation method]: https://gist.github.com/klzgrad/f124065c0616022b65e5\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocks%2FChinaDNS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowsocks%2FChinaDNS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocks%2FChinaDNS/lists"}