diff options
author | AdamEr8 <[email protected]> | 2019-02-15 09:07:18 +0200 |
---|---|---|
committer | Dave Anderson <[email protected]> | 2021-08-24 10:40:53 -0700 |
commit | 0f9bceda1a83b4a17e52ba327a6fb2561285ee1a (patch) | |
tree | fffe01810c1494e6fc12119ec35d876af15fdf4b | |
parent | 2825d768aaaef27e854631354415484406b1bc92 (diff) |
Fixed HAProxy's PROXY protocol v1 Human-readable header format in DialProxy
original code sent the header in the format: PROXY <family> <srcIP>
<srcPort> <dstIP> <dstPort>
according to docs header format should be:
PROXY <family> <srcIP> <dstIP> <srcPort> <dstPort>
this is according
to:
https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
section
2.1. Human-readable header format (Version 1).
-rw-r--r-- | tcpproxy.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tcpproxy.go b/tcpproxy.go index 9826d94..6b4a440 100644 --- a/tcpproxy.go +++ b/tcpproxy.go @@ -411,7 +411,7 @@ func (dp *DialProxy) sendProxyHeader(w io.Writer, src net.Conn) error { if srcAddr.IP.To4() == nil { family = "TCP6" } - _, err := fmt.Fprintf(w, "PROXY %s %s %d %s %d\r\n", family, srcAddr.IP, srcAddr.Port, dstAddr.IP, dstAddr.Port) + _, err := fmt.Fprintf(w, "PROXY %s %s %s %d %d\r\n", family, srcAddr.IP, dstAddr.IP, srcAddr.Port, dstAddr.Port) return err default: return fmt.Errorf("PROXY protocol version %d not supported", dp.ProxyProtocolVersion) |