We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 424fc80 commit 9171270Copy full SHA for 9171270
protocol.go
@@ -134,8 +134,13 @@ func (p *Listener) Addr() net.Addr {
134
// NewConn is used to wrap a net.Conn that may be speaking
135
// the proxy protocol into a proxyproto.Conn
136
func NewConn(conn net.Conn, opts ...func(*Conn)) *Conn {
137
+ // For v1 the header length is at most 108 bytes.
138
+ // For v2 the header length is at most 52 bytes plus the length of the TLVs.
139
+ // We use 256 bytes to be safe.
140
+ const bufSize = 256
141
+
142
pConn := &Conn{
- bufReader: bufio.NewReader(conn),
143
+ bufReader: bufio.NewReaderSize(conn, bufSize),
144
conn: conn,
145
}
146
0 commit comments