1// Copyright 2019 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// +build nethttpomithttp2 6 7package http 8 9import ( 10 "errors" 11 "sync" 12 "time" 13) 14 15func init() { 16 omitBundledHTTP2 = true 17} 18 19const noHTTP2 = "no bundled HTTP/2" // should never see this 20 21var http2errRequestCanceled = errors.New("net/http: request canceled") 22 23var http2goAwayTimeout = 1 * time.Second 24 25const http2NextProtoTLS = "h2" 26 27type http2Transport struct { 28 MaxHeaderListSize uint32 29 ConnPool interface{} 30} 31 32func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } 33func (*http2Transport) CloseIdleConnections() {} 34 35type http2erringRoundTripper struct{} 36 37func (http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } 38 39type http2noDialH2RoundTripper struct{} 40 41func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } 42 43type http2noDialClientConnPool struct { 44 http2clientConnPool http2clientConnPool 45} 46 47type http2clientConnPool struct { 48 mu *sync.Mutex 49 conns map[string][]struct{} 50} 51 52func http2configureTransport(*Transport) (*http2Transport, error) { panic(noHTTP2) } 53 54func http2isNoCachedConnError(err error) bool { 55 _, ok := err.(interface{ IsHTTP2NoCachedConnError() }) 56 return ok 57} 58 59type http2Server struct { 60 NewWriteScheduler func() http2WriteScheduler 61} 62 63type http2WriteScheduler interface{} 64 65func http2NewPriorityWriteScheduler(interface{}) http2WriteScheduler { panic(noHTTP2) } 66 67func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) } 68 69var http2ErrNoCachedConn = http2noCachedConnError{} 70 71type http2noCachedConnError struct{} 72 73func (http2noCachedConnError) IsHTTP2NoCachedConnError() {} 74 75func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" } 76