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