udp: fix proxy protocol header sent on every packet instead of first packet only (#5119)

This commit is contained in:
fatedier
2026-01-09 11:33:00 +08:00
committed by GitHub
parent 1245f8804e
commit 3370bd53f5
2 changed files with 6 additions and 2 deletions

View File

@@ -2,3 +2,7 @@
* frpc now supports a `clientID` option to uniquely identify client instances. The server dashboard displays all connected clients with their online/offline status, connection history, and metadata, making it easier to monitor and manage multiple frpc deployments. * frpc now supports a `clientID` option to uniquely identify client instances. The server dashboard displays all connected clients with their online/offline status, connection history, and metadata, making it easier to monitor and manage multiple frpc deployments.
* Redesigned the frps web dashboard with a modern UI, dark mode support, and improved navigation. * Redesigned the frps web dashboard with a modern UI, dark mode support, and improved navigation.
## Fixes
* Fixed UDP proxy protocol sending header on every packet instead of only the first packet of each session.

View File

@@ -124,8 +124,8 @@ func Forwarder(dstAddr *net.UDPAddr, readCh <-chan *msg.UDPPacket, sendCh chan<-
} }
mu.Unlock() mu.Unlock()
// Add proxy protocol header if configured // Add proxy protocol header if configured (only for the first packet of a new connection)
if proxyProtocolVersion != "" && udpMsg.RemoteAddr != nil { if !ok && proxyProtocolVersion != "" && udpMsg.RemoteAddr != nil {
ppBuf, err := netpkg.BuildProxyProtocolHeader(udpMsg.RemoteAddr, dstAddr, proxyProtocolVersion) ppBuf, err := netpkg.BuildProxyProtocolHeader(udpMsg.RemoteAddr, dstAddr, proxyProtocolVersion)
if err == nil { if err == nil {
// Prepend proxy protocol header to the UDP payload // Prepend proxy protocol header to the UDP payload