(feat) Add PROXY protocol v2 (PPv2) header support#115
Open
zongqi-wang wants to merge 1 commit intoDNS-OARC:mainfrom
Open
(feat) Add PROXY protocol v2 (PPv2) header support#115zongqi-wang wants to merge 1 commit intoDNS-OARC:mainfrom
zongqi-wang wants to merge 1 commit intoDNS-OARC:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--proxy SRC_ADDR[#SRC_PORT]-DST_ADDR[#DST_PORT]CLI option to prepend PROXY protocol v2 headers to DNS queriesProtocolenum intoprotocol.hto break circular dependency with newproxy.h/proxy.cppmoduleTrafGento avoid per-packet reconstructionTest plan
meson testpasses (all 30+ proxy protocol tests)ninjabuilds cleanly withwarning_level=3flame --proxy 127.0.0.1#4321-127.0.0.2#53 <target>over UDPflame -P tcp --proxy 127.0.0.1#4321-127.0.0.2#53 <target>over TCP[::1]bracket syntaxTesting notes
UDP + IPv4 proxy
TCP + IPv4 proxy
UDP + IPv6 proxy
Wire capture verification
Captured a UDP packet sent to a local listener and verified every field:
Design notes
TrafGen::start()and cached in_cached_proxy_headerto avoid per-packet allocation overhead.on_connect_event()(TLS handshake). libuv guarantees FIFO write ordering, so the header precedes the ClientHello.--proxyflag usesAF_UNSPECfor address family auto-detection, since the PPv2 header describes the original client's addresses, not the flamethrower transport.