core/dnsserver: preserve UDP packet destination addresses (#8644)

* core/dnsserver: preserve UDP packet destination addresses

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

* test: modernize reverse UDP reply traversal

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

* test: account for Unix IPv4 source-control capabilities

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

---------

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>
This commit is contained in:
houyuwushang
2026-10-21 11:34:18 +08:00
committed by GitHub
parent e7f823b261
commit 0fe7b08fbb
12 changed files with 1026 additions and 3 deletions

View File

@@ -200,6 +200,15 @@ func (a *Addr) Unwrap() net.Addr {
return a.r
}
// LocalAddr returns the transport packet's destination when the underlying
// address carries one. It is independent of the PROXY header's destination.
func (a *Addr) LocalAddr() net.Addr {
if packet, ok := a.u.(interface{ LocalAddr() net.Addr }); ok {
return packet.LocalAddr()
}
return nil
}
// tlvsFor returns the header's raw TLVs when TLV capture is enabled, else nil.
func (c *PacketConn) tlvsFor(header *proxyproto.Header) []byte {
if !c.CaptureTLVs {