http2x

package
v0.0.0-...-19e231a Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package http2x provides extensions to standard http2 functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatibleHTTP2Layer = errors.New("http2x: incompatible http2 client library")
	ErrUnsupportedTransport   = errors.New("http2x: unsupported transport layer")
)

Functions

func GetClientConn

func GetClientConn(pool http2.ClientConnPool, addr string) (*http2.ClientConn, error)

GetClientConn returns http2.ClientConn from the pool that can be used to communicate with the endpoint specified by the addr. Note that the pool may initiate a dial operation at this time if no active connection to addr exists.

func GetClientConnPool

func GetClientConnPool(t http.RoundTripper) (http2.ClientConnPool, error)

GetClientConnPool returns http2.Transport t's ClientConnPool. If t is not a *http2.Transport, ErrUnsupportedTransport error is returned.

GetClientConnPool must be used with extreme caution. It relies on the side effect of http2.Transport.CloseIdleConnections to ensure t's connection pool is initialized before trying to access it. The only safe time for this call is before t has had a chance to open its first connection.

func GetMaxConcurrentStreams

func GetMaxConcurrentStreams(c *http2.ClientConn) uint32

GetMaxConcurrentStreams returns the value of maxConcurrentStreams private field of c using reflection. It properly guards its read with c's mutex.

If c is nil, 1 is returned. If c is closed, 0 is returned. Otherwise, if maxConcurrentStreams cannot be determined due to http2.ClientConn incompatibility, maximum uint32 value is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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