const HeaderConnection … const HeaderUpgrade … const HeaderProtocolVersion … const HeaderAcceptedProtocolVersions … type NewStreamHandler … // NoOpNewStreamHandler is a stream handler that accepts a new stream and // performs no other logic. func NoOpNewStreamHandler(stream Stream, replySent <-chan struct{ … } type Dialer … type UpgradeRoundTripper … type ResponseUpgrader … type Connection … type Stream … type UpgradeFailureError … func (u *UpgradeFailureError) Error() string { … } // IsUpgradeFailure returns true if the passed error is (or wrapped error contains) // the UpgradeFailureError. func IsUpgradeFailure(err error) bool { … } // isHTTPSProxyError returns true if error is Gorilla/Websockets HTTPS Proxy dial error; // false otherwise (see https://github.com/kubernetes/kubernetes/issues/126134). func IsHTTPSProxyError(err error) bool { … } // IsUpgradeRequest returns true if the given request is a connection upgrade request func IsUpgradeRequest(req *http.Request) bool { … } func negotiateProtocol(clientProtocols, serverProtocols []string) string { … } func commaSeparatedHeaderValues(header []string) []string { … } // Handshake performs a subprotocol negotiation. If the client did request a // subprotocol, Handshake will select the first common value found in // serverProtocols. If a match is found, Handshake adds a response header // indicating the chosen subprotocol. If no match is found, HTTP forbidden is // returned, along with a response header containing the list of protocols the // server can accept. func Handshake(req *http.Request, w http.ResponseWriter, serverProtocols []string) (string, error) { … }