// Any is a Matcher that matches any connection. func Any() Matcher { … } // PrefixMatcher returns a matcher that matches a connection if it // starts with any of the strings in strs. func PrefixMatcher(strs ...string) Matcher { … } func prefixByteMatcher(list ...[]byte) Matcher { … } var defaultHTTPMethods … // HTTP1Fast only matches the methods in the HTTP request. // // This matcher is very optimistic: if it returns true, it does not mean that // the request is a valid HTTP response. If you want a correct but slower HTTP1 // matcher, use HTTP1 instead. func HTTP1Fast(extMethods ...string) Matcher { … } // TLS matches HTTPS requests. // // By default, any TLS handshake packet is matched. An optional whitelist // of versions can be passed in to restrict the matcher, for example: // TLS(tls.VersionTLS11, tls.VersionTLS12) func TLS(versions ...int) Matcher { … } const maxHTTPRead … // HTTP1 parses the first line or upto 4096 bytes of the request to see if // the conection contains an HTTP request. func HTTP1() Matcher { … } // grabbed from net/http. func parseRequestLine(line string) (method, uri, proto string, ok bool) { … } // HTTP2 parses the frame header of the first frame to detect whether the // connection is an HTTP2 connection. func HTTP2() Matcher { … } // HTTP1HeaderField returns a matcher matching the header fields of the first // request of an HTTP 1 connection. func HTTP1HeaderField(name, value string) Matcher { … } // HTTP1HeaderFieldPrefix returns a matcher matching the header fields of the // first request of an HTTP 1 connection. If the header with key name has a // value prefixed with valuePrefix, this will match. func HTTP1HeaderFieldPrefix(name, valuePrefix string) Matcher { … } // HTTP2HeaderField returns a matcher matching the header fields of the first // headers frame. func HTTP2HeaderField(name, value string) Matcher { … } // HTTP2HeaderFieldPrefix returns a matcher matching the header fields of the // first headers frame. If the header with key name has a value prefixed with // valuePrefix, this will match. func HTTP2HeaderFieldPrefix(name, valuePrefix string) Matcher { … } // HTTP2MatchHeaderFieldSendSettings matches the header field and writes the // settings to the server. Prefer HTTP2HeaderField over this one, if the client // does not block on receiving a SETTING frame. func HTTP2MatchHeaderFieldSendSettings(name, value string) MatchWriter { … } // HTTP2MatchHeaderFieldPrefixSendSettings matches the header field prefix // and writes the settings to the server. Prefer HTTP2HeaderFieldPrefix over // this one, if the client does not block on receiving a SETTING frame. func HTTP2MatchHeaderFieldPrefixSendSettings(name, valuePrefix string) MatchWriter { … } func hasHTTP2Preface(r io.Reader) bool { … } func matchHTTP1Field(r io.Reader, name string, matches func(string) bool) (matched bool) { … } func matchHTTP2Field(w io.Writer, r io.Reader, name string, matches func(string) bool) (matched bool) { … }