Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否运行时检查 /etc/hosts 的更改来载入变更? #3

Closed
wuyongzhi opened this issue Jun 6, 2014 · 2 comments
Closed

能否运行时检查 /etc/hosts 的更改来载入变更? #3

wuyongzhi opened this issue Jun 6, 2014 · 2 comments

Comments

@wuyongzhi
Copy link

经过我的测试,似乎还没有这个特性,我可以考虑添加一个PR完善它

@kenshinx
Copy link
Owner

kenshinx commented Jun 7, 2014

不推荐这么做,你想要的这个特性其实已经实现了。
godns收到一个dns查询时,会按照下面三个步骤进行解析:

  1. 查询本机/etc/hosts配置
  2. 查询redis服务器是否有匹配记录,因此你想实现运行时更新解析结果,只要在redis中添加一条记录就ok了。添加一条redis记录也有两种方式:
    • 直接操作redis,默认key是godns:hosts,例如redis > hset godns:hosts www.sina.com.cn 1.1.1.1
    • 通过joke进行管理
  3. 上面两步都没查到相应记录,就会交给上层递归解析

因此推荐你把redis部署起来,然后通过joke来管理动态解析结果。:p

@wuyongzhi
Copy link
Author

收到了解了。我之前没尝试joke成功。现在已OK了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants