github.com/guyezi/gofrontend@v0.0.0-20200228202240-7a62a49e62c0/libgo/go/net/http/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  // +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          interface{}
    30  }
    31  
    32  func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    33  func (*http2Transport) CloseIdleConnections()                 {}
    34  
    35  type http2erringRoundTripper struct{}
    36  
    37  func (http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    38  
    39  type http2noDialH2RoundTripper struct{}
    40  
    41  func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    42  
    43  type http2noDialClientConnPool struct {
    44  	http2clientConnPool http2clientConnPool
    45  }
    46  
    47  type http2clientConnPool struct {
    48  	mu    *sync.Mutex
    49  	conns map[string][]struct{}
    50  }
    51  
    52  func http2configureTransport(*Transport) (*http2Transport, error) { panic(noHTTP2) }
    53  
    54  func http2isNoCachedConnError(err error) bool {
    55  	_, ok := err.(interface{ IsHTTP2NoCachedConnError() })
    56  	return ok
    57  }
    58  
    59  type http2Server struct {
    60  	NewWriteScheduler func() http2WriteScheduler
    61  }
    62  
    63  type http2WriteScheduler interface{}
    64  
    65  func http2NewPriorityWriteScheduler(interface{}) http2WriteScheduler { panic(noHTTP2) }
    66  
    67  func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) }
    68  
    69  var http2ErrNoCachedConn = http2noCachedConnError{}
    70  
    71  type http2noCachedConnError struct{}
    72  
    73  func (http2noCachedConnError) IsHTTP2NoCachedConnError() {}
    74  
    75  func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" }