Go 寫的 HttpDns 服務:goHttpDns

jopen 9年前發布 | 30K 次閱讀 goHttpDns Google Go/Golang開發

一個用 Go 寫的 HttpDns 服務, 為了抵抗運營商邪惡的 DNS 劫持污染,并帶有緩存功能 。

How To Compile

cd $GOPATH;
git clone http://github.com/zheng-ji/goHttpDns;
cd src;
make

How To Configure

# redis connect config
redis:
  host: 127.0.0.1:6379
  db: 0

# seelog config 
log_config: ../etc/logger.xml

# ip & port & answer cache TTL
listen: 0.0.0.0
port: 9999
ttl: 100

# DnsServer lists
dnsservers:
    - 202.96.128.86
    - 202.96.128.166
    - 8.8.8.8
    - 8.8.4.4

How To Run

Aftermake, a binary executable file calledhttpDnswill be generated under thebindirectory

zj@zheng-ji:$ ./httpDns --help
Usage of ./httpDns:
  -c="../etc/conf.yml": conf file,default is ../etc/conf.yml

./httpDns -c="your_conf_yaml_path"

You can also usesupervisorto start your sever

How To Use

$ curl http://127.0.0.1:9999/d?url=http://zheng-ji.info

Resp:
{
    "c":0,
    "targetip":"http://106.185.48.24",
    "host":"zheng-ji.info",
    "msg":""
}

Dependece Third Part Lib

Thanks to:

項目主頁:http://www.baiduhome.net/lib/view/home/1440399349185

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!