代码进行直接DNS查找 [英] Code to do a direct DNS lookup

查看:131
本文介绍了代码进行直接DNS查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑以不同的方式运行实验来跟踪DNS值(例如,他们更改频率以及什么)。为了做到这一点,我需要能够直接向服务器发出一个DNS请求,以便1)我知道它是什么服务器,2)我可以请求几个服务器的响应,3)我可以避免本地操作系统运行缓存有没有人知道一个图书馆(c#,D,C,C ++,按照这个优先顺序),让我直接查询一个DNS服务器?

I'm thinking of running an experiment to track DNS values in different ways (like how often they change and whatnot). To do this I will need to be able to make a DNS request directly to a server so that 1) I known what server it came from, 2) I can request responses from several servers and 3) I can avoid the local OS run cache.

/ em>没有,有没有人知道一个容易理解的DNS协议的描述,我可以实现这样一个系统?

Does anyone know of a library (c#, D, C, C++ in that order of preference) that will let me directly query a DNS server? Failing that, does anyone know of a easy to understand description of the DNS protocol that I could implement such a system from?

推荐答案

我只有C的经验,所以这里是我的列表:

I have experience only with C, so here is my list:


  • libresolv是旧的,传统的和标准的方式。它可以在每个Unix(类型 man 3 resolver )上使用,并且包括例如
    res_query 或更少你想要什么要查询特定的名称服务器,您通常会更新全局变量 _res.nsaddr_list (请注意,显然,它不适用于IPv6 )。

  • libresolv is the old, traditional and standard way. It is available on every Unix (type man 3 resolver) and includes routines like res_query which does more or less what you want. To query a specific name server, you typically update the global variable _res.nsaddr_list (do note that, apparently, it does not work with IPv6).

ldns 是现代和闪亮的解决方案。您有在线良好的文档

ldns is the modern and shiny solution. You have good documentation online.

一个非常常见的图书馆,但显然不成立,是 adns

a very common library, but apparently unmaintained, is adns.

这篇关于代码进行直接DNS查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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