myhttpdns

command module
v0.0.0-...-0c9d40a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2019 License: MIT Imports: 16 Imported by: 0

README

myhttpdns

DNS 服务器,接收标准 DNS 查询请求,然后通过查询 http dns 获取结果返回给客户端。

Build Status

主要特性
  1. 对外通过 http dns 查询,避免 DNS 劫持
  2. 提供标准 DNS 查询接口,可以直接将机器的 dns 配置到 myhttpdns
  3. DNS 查询结果根据 TTL 进行缓存
  4. 对外 DNS 查询请求归并
  5. 提供详细的审计日志,包括请求来源 IP、缓存个数、请求的域名、TTL、响应时间以及解析结果
  6. 支持 hosts 文件与本地文件,可以通过文件名设置 TTL,比如 hosts.600 设置 TTL 为 600 秒
  7. http dns 查询失败改用默认的 DNS 查询
  8. 请求domain 为 myip 返回客户端的来源 IP
  9. 支持 Dnspod 和 Cloudflare 两家 dns
如何安装
go get -v github.com/ma6174/myhttpdns
如何使用
sudo myhttpdns
  • 默认监听53端口需要管理员权限,可以增加-bind "127.0.0.1:8053"改变监听端口
测试

使用 dig 进行 dns 查询

$ dig +short @127.0.0.1 google.com
216.58.200.46
$ dig +short @127.0.0.1 google.com
216.58.200.46
$ dig +short @127.0.0.1 baidu.com
180.149.132.47
220.181.57.217
111.13.101.208
123.125.114.144
$ dig +short @127.0.0.1 baidu.com
180.149.132.47
220.181.57.217
111.13.101.208
123.125.114.144

程序日志输出

$ sudo myhttpdns
2017/04/09 22:37:49 dns server running at 0.0.0.0:53
2017/04/09 22:37:53 127.0.0.1:59022	139s	24.213ms	google.com.	[216.58.200.46]
2017/04/09 22:37:54 127.0.0.1:50891	138s	0.075ms	google.com.	[216.58.200.46]
2017/04/09 22:37:58 127.0.0.1:56055	98s	22.455ms	baidu.com.	[180.149.132.47 220.181.57.217 111.13.101.208 123.125.114.144]
2017/04/09 22:37:59 127.0.0.1:55850	97s	0.057ms	baidu.com.	[180.149.132.47 220.181.57.217 111.13.101.208 123.125.114.144]

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL