{"id":16905291,"url":"https://github.com/tobyxdd/anchordns","last_synced_at":"2025-10-05T15:17:24.949Z","repository":{"id":84165050,"uuid":"39336726","full_name":"tobyxdd/anchorDNS","owner":"tobyxdd","description":"A smart DNS server for Chinese","archived":false,"fork":false,"pushed_at":"2016-04-02T08:53:45.000Z","size":97,"stargazers_count":67,"open_issues_count":4,"forks_count":20,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T06:03:44.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobyxdd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-19T14:33:08.000Z","updated_at":"2025-03-16T11:11:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"30769fee-bb16-4cef-a924-3f653b5bf098","html_url":"https://github.com/tobyxdd/anchorDNS","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tobyxdd/anchorDNS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2FanchorDNS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2FanchorDNS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2FanchorDNS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2FanchorDNS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyxdd","download_url":"https://codeload.github.com/tobyxdd/anchorDNS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2FanchorDNS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278472407,"owners_count":25992643,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-13T18:38:00.896Z","updated_at":"2025-10-05T15:17:24.932Z","avatar_url":"https://github.com/tobyxdd.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# anchorDNS ![adnsLogo][1]\n\n**anchorDNS** 是一个根据IP段请求不同源的分流DNS服务器\n\n#这能干啥？\n\n众所周知的 [CHNRoutes][2] 项目能够修改系统路由表使拨VPN后 中国IP依然直接连接，仅国外连接通过VPN以防止国内网站也通过VPN绕行。然而为了解决DNS污染，一般会让DNS解析全部走VPN到国外DNS服务器，因此上了CDN或有国外服务器的中国网站 依然会解析到国外或国内非最佳服务器降低访问速度。\n\nanchorDNS 正是为解决此问题而设计，通过先从国内DNS解析域名，若发现是中国IP则直接返回结果，若非中国IP则改用境外DNS解析的方法 能够既完全保持国内网站的解析正确 又获得无污染的境外网站DNS查询结果。\n\n示例——\n\n解析 www.baidu.com -\u003e 同时查询114.114.114.114(直连)/8.8.8.8(走VPN) -\u003e 发现是中国IP网站 -\u003e 使用直连114.114.114.114的结果\n\n解析 twitter.com -\u003e 同时查询114.114.114.114(直连)/8.8.8.8(走VPN) -\u003e 发现非中国IP网站 -\u003e 使用走VPN的8.8.8.8的结果（无污染）\n\n#使用姿势\n\n去 Release 下载最新版，解压后bin目录下 带参数运行 anchorDNS\n\n参数详解——\n\n    usage: anchorDNS\n     -a,--alternativeDNS \u003carg\u003e   Specify the alternative DNS server. Default:\n                                 8.8.8.8,8.8.4.4,208.67.222.222,208.67.220.220\n     -c,--cidr \u003carg\u003e             Specify the CIDR list. Default: Download from\n                                 IPdeny\n     -d,--defaultDNS \u003carg\u003e       Specify the default DNS server. Default:\n                                 119.29.29.29,182.254.116.116,223.5.5.5,223.6.\n                                 6.6\n     -f,--fallback               Use alternative DNS when default DNS failed.\n     -h,--help                   Show this help message.\n     -i,--ip \u003carg\u003e               Specify the listening IP. Default: 127.0.0.1\n     -n,--nocache                Disable results cache.\n     -p,--port \u003carg\u003e             Specify the listening port. Default: 53\n     -t,--timeout \u003carg\u003e          Specify the DNS time out (sec). Default: 2\n     -v,--verbose                Verbose mode.\n\n    -a 指定国外DNS服务器\n    -c 指定中国IP CIDR表（默认会自动从IPdeny下载最新并保存为 ChinaCIDR.txt ）\n    -d 指定国内DNS服务器\n    -f 当国内DNS超时或出错时也转至国外DNS\n    -h 显示上述帮助\n    -i 指定监听IP（本地请使用默认127.0.0.1）\n    -n 禁用查询缓存\n    -p 指定监听端口\n    -t DNS查询超时时间 单位：秒 默认为2\n    -v 显示每个 DNS 请求查询的情况的调试输出模式\n\n可以直接不带任何参数使用默认值使用，也可进行自定义如： `anchorDNS -d 1.2.4.8 -a 8.8.4.4 -f -c ChinaCIDR_NEW.txt`\n\n**然后设置机器的DNS服务器为 127.0.0.1**\n\n中国IP段的CIDR表可在[此处下载更新][3]\n\n#技术细节\n\n使用 dnsjava 处理DNS通信，Gradle构建，JDK1.8+\n\n  [1]: logo.png \"anchorDNS\"\n  [2]: https://github.com/fivesheep/chnroutes\n  [3]: http://www.ipdeny.com/ipblocks/data/aggregated/cn-aggregated.zone\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyxdd%2Fanchordns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyxdd%2Fanchordns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyxdd%2Fanchordns/lists"}