h2c

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2020 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer struct {
	Dialer    *net.Dialer
	TLSConfig *tls.Config
	URL       *url.URL
}

Dialer connects to a HTTP 1.1 server and performs an h2c upgrade to an HTTP2 connection.

func (Dialer) Dial

func (d Dialer) Dial(network, addr string) (net.Conn, error)

Dial connects to the address on the named network.

func (Dialer) DialContext

func (d Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

DialContext connects to the address on the named network using the provided context.

func (Dialer) DialGRPC

func (d Dialer) DialGRPC(addr string, timeout time.Duration) (net.Conn, error)

DialGRPC connects to the address before timeout. Deprecated: use DialGRPCContext and grpc.WithContextDialer.

func (Dialer) DialGRPCContext added in v1.6.0

func (d Dialer) DialGRPCContext(ctx context.Context, addr string) (net.Conn, error)

DialGRPCContext implements the interface required by grpc.WithContextDialer.

type Server

type Server struct {
	HTTP2Handler      http.Handler
	NonUpgradeHandler http.Handler
	// ALBSupport can be used to enable this listener to work behind a AWS ALB.
	// These strip the Connection header for non-websocket upgrades, so we only
	// use the Upgrade header in this case. This is not to spec, but seems to
	// work OK.
	ALBSupport bool
	// contains filtered or unexported fields
}

Server is an HTTP 1.1 server that can detect h2c upgrades and serve them by an HTTP2 handler.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown added in v1.7.1

func (s *Server) Shutdown(ctx context.Context) error

Shutdown blocks until all connections have completed. Note that this will not actually close the listener, since we don't have access to it here. Instead, it is assumed that the caller has already closed the underlying listener prior to calling Shutdown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL