func HTTP2() Matcher {
	return hasHTTP2Preface
}
HTTP2 parses the frame header of the first frame to detect whether the
connection is an HTTP2 connection.
package cmux
import (
	"bufio"
	"io"
	"io/ioutil"
	"net/http"
	"strings"
	"golang.org/x/net/http2"
	"golang.org/x/net/http2/hpack"
)
func Any() Matcher {
	return func(r io.Reader) bool { return true }
}
func PrefixMatcher(strs ...string) Matcher {
	pt := newPatriciaTreeString(strs...)
	return pt.matchPrefix
}
var defaultHTTPMethods = []string{
	"OPTIONS",
	"GET",
	"HEAD",
	"POST",
	"PUT",
	"DELETE",
	"TRACE",
	"CONNECT",
}
func HTTP1Fast(extMethods ...string) Matcher {
	return PrefixMatcher(append(defaultHTTPMethods, extMethods...)...)
}
const maxHTTPRead = 4096
func HTTP1() Matcher {
	return func(r io.Reader) bool {
		br := bufio.NewReader(&io.LimitedReader{R: r, N: maxHTTPRead})
		l, part, err := br.ReadLine()
		if err != nil || part {
			return false
		}
		_, _, proto, ok := parseRequestLine(string(l))
		if !ok {
			return false
		}
		v, _, ok := http.ParseHTTPVersion(proto)
		return ok && v == 1
	}
}
func parseRequestLine(line string) (method, uri, proto string, ok bool) {
	s1 := strings.Index(line, " ")
	s2 := strings.Index(line[s1+1:], " ")
	if s1 < 0 || s2 < 0 {
		return
	}
	s2 += s1 + 1
	return line[:s1], line[s1+1 : s2], line[s2+1:], true
}