Skip to content

Support for TCP Fast Open (TFO) in DNS over TCP and DNS over TLS #501

@fcchbjm

Description

@fcchbjm

内容 / Description
中文版本

您好,

首先感谢您对 dnsproxy 项目的持续维护和出色工作。

我想提出一个关于在 DNS over TCP(DoT)和 DNS over TLS(DoT)中支持 TCP Fast Open(TFO)的改进建议。

需要说明的是,我并不是一名专业的 Go 语言工程师,但我借助 AI 工具完成了一些相关开发工作。目前,我已经在自己的 Fork 版本中初步实现了该功能,并验证其在一定场景下能够改善连接建立性能。

本 Issue 的核心建议如下:

  1. 为 DNS over TCP 和 DNS over TLS 启用 TCP Fast Open(TFO)支持
    TFO 可以减少 TCP 握手延迟,在高延迟网络环境下具有明显优势,特别适用于 DNS 这类短连接请求场景。
  2. 关于 OpenBSD 平台的兼容性问题
    据我了解,目前 TFO 相关 socket 选项在 OpenBSD 平台上不可用。因此,可能需要针对 OpenBSD 提供不启用 TFO 的兼容实现,或进行条件编译处理。
  3. Multipath TCP(MPTCP)兼容性问题
    在我的测试中,启用 TFO 时需要关闭 Multipath TCP,否则可能出现兼容性问题。因此,这两者之间的关系可能需要在实现中加以处理或说明。

如果该方向符合项目设计目标,我也非常愿意整理并提交一个 PR(基于我当前的 Fork 实现)供进一步讨论和改进。

感谢您的时间与付出!

English Version

Hello,

First of all, thank you for your continuous work and maintenance of the dnsproxy project.

I would like to propose an enhancement regarding support for TCP Fast Open (TFO) in both DNS over TCP and DNS over TLS.

Please note that I am not a professional Go developer; however, with the assistance of AI tools, I have implemented a preliminary version of this feature in my own fork and verified that it can improve connection setup performance in certain scenarios.

The main points of this proposal are as follows:

  1. Enable TCP Fast Open (TFO) for DNS over TCP and DNS over TLS
    TFO can reduce TCP handshake latency, which is particularly beneficial in high-latency environments. This is especially relevant for DNS workloads, where connections are typically short-lived.
  2. Compatibility considerations for OpenBSD
    As far as I understand, TFO-related socket options are not available on OpenBSD. Therefore, it may be necessary to provide a fallback implementation without TFO or handle this via conditional compilation.
  3. Interaction with Multipath TCP (MPTCP)
    In my testing, enabling TFO requires disabling Multipath TCP, otherwise compatibility issues may occur. This interaction may need to be handled or documented in the implementation.

If this direction aligns with the project goals, I would be happy to prepare and submit a pull request based on my current fork for further discussion and refinement.

Thank you for your time and consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions