zhboner / realm

A network relay tool
MIT License
1.48k stars 279 forks source link

Proxy Protocol not Working on UDP Traffic #88

Closed G5Hg3EmMa9ss97 closed 1 year ago

G5Hg3EmMa9ss97 commented 1 year ago

Hi,

It seems that proxy protocol header doesn't send properly when forwarding UDP traffic. I ran realm using realm -l 0.0.0.0:102 -r remote-ip:102 --udp --send-proxy command.

On the remote server, client IP and port can be obtained only in TCP traffic. Can you please confirm whether this is expected? Thanks.

zephyrchien commented 1 year ago

Yes, this is expected behavior. Proxy Protocol is mainly designed for TCP, the spec does not include details about UDP. Its inventor, Haproxy, known as TCP load balancer, does not support UDP either.

It seems some proxies do support UDP Proxy Protocol, such as Nginx, Cloudflare's Spectrum. They prepend the PROXY header to the first packet on a stream(packets from the same source). I will consider adding this feature with the same approach though, as this comment said, It might not be a good idea.