创建c自定义DNS域名服务器 [英] Create custom DNS name server in C

查看:134
本文介绍了创建c自定义DNS域名服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要创建使用C将检查对一​​个MySQL数据库,看看客户端IP需要被引导到不同的服务器的自定义DNS域名服务器。使用此为测试网络,以便请求foo.com如果启用了真正的查询只会去那里,否则请求将被定向到一个发展的ENV。任何建议/建议?

Need to create a custom DNS name server using C which will check against a mysql db to see if the client IP need to be directed to a different server. Using this for a test network so requests to foo.com will only go there if true lookup is enabled, otherwise requests will be directed to a development env. Any suggestions/recommendations?

目前在看的libevent的东西,如LDNS或C-战神

Currently looking at libevent with something like ldns or c-ares

推荐答案

我结束了,其中包含了自己的功能来处理DNS请求的libevent 1.4下去。该LIBEVENT包含evdns功能是pretty直线前进,并在那里正是我需要创建自定义的q DNS服务器。我看了看使用绑定,但没有想要对付不必设置区和额外的配置,evdns让我基于信息使用现有的resolv.conf按需要转发的DNS请求,以实名服务器和修改响应包含在一个MySQL表。

I ended up going with libevent 1.4 which contains its own functions for dealing with dns requests. The evdns functions that libevent contains are pretty straight forward and where exactly what i needed to create q custom dns server. I looked at using bind, but didnt want to deal with having to set up zones and extra configuration, evdns allowed me to use the existing resolv.conf to forward any dns requests to real name servers and to modify the responses as needed based on information contained in a mysql table.

这篇关于创建c自定义DNS域名服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆