// Match returns true if the connection looks like it is using the Proxy Protocol.
Match returns true if the connection looks like it is using the Proxy Protocol.
// Match returns true if the connection looks like it is using the Proxy Protocol .
func (m MatchProxyProtocol) Match(cx *layer4.Connection) (bool, error) {
	buf := make([]byte, len(headerV2Prefix))
	_, err := io.ReadFull(cx, buf)
	if err != nil {
		return false, err
	}
	if bytes.HasPrefix(buf, headerV1Prefix) {
		return true, nil
	}
	if bytes.Equal(buf, headerV2Prefix) {
		return true, nil
	}
	return false, nil
}
func ( m MatchProxyProtocol ) Match ( cx * layer4 . Connection ) ( bool , error ) { buf := make ( [ ] byte , len ( headerV2Prefix ) ) _ , err := io . ReadFull ( cx , buf ) if err != nil { return false , err } if bytes . HasPrefix ( buf , headerV1Prefix ) { return true , nil } if bytes . Equal ( buf , headerV2Prefix ) { return true , nil } return false , nil }
Match returns true if the connection looks like it is using the Proxy Protocol.
Match returns true if the connection looks like it is using the Proxy Protocol .