github.com/Kolosok86/http@v0.1.2/omithttp2.go (about) 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 //go:build nethttpomithttp2 6 7 package http 8 9 import ( 10 "errors" 11 "sync" 12 "time" 13 ) 14 15 func init() { 16 omitBundledHTTP2 = true 17 } 18 19 const noHTTP2 = "no bundled HTTP/2" // should never see this 20 21 var http2errRequestCanceled = errors.New("net/http: request canceled") 22 23 var http2goAwayTimeout = 1 * time.Second 24 25 const http2NextProtoTLS = "h2" 26 27 type http2Transport struct { 28 MaxHeaderListSize uint32 29 ConnPool any 30 } 31 32 func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } 33 func (*http2Transport) CloseIdleConnections() {} 34 35 type http2noDialH2RoundTripper struct{} 36 37 func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) } 38 39 type http2noDialClientConnPool struct { 40 http2clientConnPool http2clientConnPool 41 } 42 43 type http2clientConnPool struct { 44 mu *sync.Mutex 45 conns map[string][]struct{} 46 } 47 48 func http2configureTransports(*Transport) (*http2Transport, error) { panic(noHTTP2) } 49 50 func http2isNoCachedConnError(err error) bool { 51 _, ok := err.(interface{ IsHTTP2NoCachedConnError() }) 52 return ok 53 } 54 55 type http2Server struct { 56 NewWriteScheduler func() http2WriteScheduler 57 } 58 59 type http2WriteScheduler any 60 61 func http2NewPriorityWriteScheduler(any) http2WriteScheduler { panic(noHTTP2) } 62 63 func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) } 64 65 var http2ErrNoCachedConn = http2noCachedConnError{} 66 67 type http2noCachedConnError struct{} 68 69 func (http2noCachedConnError) IsHTTP2NoCachedConnError() {} 70 71 func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" }