如何在 C/C++ 中构建自定义的简单 DNS 服务器

2023-10-17C/C++开发问题
0

本文介绍了如何在 C/C++ 中构建自定义的简单 DNS 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我需要在 C/C++ 中构建一个自定义的简单非权威缓存 DNS 服务器.任何指导?链接?样品?

I need to build a custom simple non-authoritative caching DNS server in C/C++. Any guidance? Links? Samples?

推荐答案

没有简单"缓存 DNS 服务器这样的东西,特别是如果您想要体面的安全性.最近的 DNS 攻击表明递归 DNS 服务器中的缓存功能特别容易受到攻击.

There's no such thing as a "simple" cacheing DNS server, particularly if you want decent security. Recent DNS attacks have shown that the cacheing function in recursive DNS servers is particularly vulnerable.

重新评估您是否真的需要自己的本地缓存.如果不这样做,您可能最好修改现有的 DNS 代理代码(例如dnsmasq").

Re-evaluate whether you actually need local cacheing of your own. If you don't, you're probably better off modifying existing DNS proxy code (such as 'dnsmasq').

如果您确实想自己动手,有一些不错的库,例如 ldns 可以提供对底层 DNS 数据包的访问.

If you do want to roll-your-own, there are good libraries such as ldns which can provide the access to the underlying DNS packets.

我自己使用 ldnslibevent 来实现我在前面的问题中提到的 Fuzzing DNS 服务器.

I'm using ldns myself in conjunction with libevent to implement the Fuzzing DNS server I mentioned in an earlier question.

这篇关于如何在 C/C++ 中构建自定义的简单 DNS 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6