From 0f9bceda1a83b4a17e52ba327a6fb2561285ee1a Mon Sep 17 00:00:00 2001 From: AdamEr8 Date: Fri, 15 Feb 2019 09:07:18 +0200 Subject: Fixed HAProxy's PROXY protocol v1 Human-readable header format in DialProxy original code sent the header in the format: PROXY according to docs header format should be: PROXY this is according to: https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt section 2.1. Human-readable header format (Version 1). --- tcpproxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3