您能获取使用 Rust UDP 套接字发送到的域 UDP 数据吗?

发布于 2025-01-18 16:58:46 字数 338 浏览 0 评论 0原文

我有一个看起来如下的小程序:

let sock = UdpSocket::bind("0.0.0.0:1024").unwrap();
let mut buf = [0; 10000];
loop {
    let (len, src) = sock.recv_from(&mut buf).unwrap();
    let buf = &mut buf[..len];

    // do stuff
}

假设有人将数据发送到示例:1024,是否有任何方法知道他们将数据发送到example.com不仅是源IP地址?

I have a small program that looks like the following:

let sock = UdpSocket::bind("0.0.0.0:1024").unwrap();
let mut buf = [0; 10000];
loop {
    let (len, src) = sock.recv_from(&mut buf).unwrap();
    let buf = &mut buf[..len];

    // do stuff
}

Let's say someone sends data to example.com:1024, is there any way to know they sent the data to example.com and not just the source IP address?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文