spdy

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 27 Imported by: 346

Documentation

Index

Constants

View Source
const HeaderSpdy31 = "SPDY/3.1"

Variables

This section is empty.

Functions

func NewClientConnection

func NewClientConnection(conn net.Conn) (httpstream.Connection, error)

NewClientConnection creates a new SPDY client connection.

func NewClientConnectionWithPings added in v0.20.0

func NewClientConnectionWithPings(conn net.Conn, pingPeriod time.Duration) (httpstream.Connection, error)

NewClientConnectionWithPings creates a new SPDY client connection.

If pingPeriod is non-zero, a background goroutine will send periodic Ping frames to the server. Use this to keep idle connections through certain load balancers alive longer.

func NewResponseUpgrader

func NewResponseUpgrader() httpstream.ResponseUpgrader

NewResponseUpgrader returns a new httpstream.ResponseUpgrader that is capable of upgrading HTTP responses using SPDY/3.1 via the spdystream package.

func NewResponseUpgraderWithPings added in v0.20.0

func NewResponseUpgraderWithPings(pingPeriod time.Duration) httpstream.ResponseUpgrader

NewResponseUpgraderWithPings returns a new httpstream.ResponseUpgrader that is capable of upgrading HTTP responses using SPDY/3.1 via the spdystream package.

If pingPeriod is non-zero, for each incoming connection a background goroutine will send periodic Ping frames to the server. Use this to keep idle connections through certain load balancers alive longer.

func NewServerConnection

func NewServerConnection(conn net.Conn, newStreamHandler httpstream.NewStreamHandler) (httpstream.Connection, error)

NewServerConnection creates a new SPDY server connection. newStreamHandler will be invoked when the server receives a newly created stream from the client.

func NewServerConnectionWithPings added in v0.20.0

func NewServerConnectionWithPings(conn net.Conn, newStreamHandler httpstream.NewStreamHandler, pingPeriod time.Duration) (httpstream.Connection, error)

NewServerConnectionWithPings creates a new SPDY server connection. newStreamHandler will be invoked when the server receives a newly created stream from the client.

If pingPeriod is non-zero, a background goroutine will send periodic Ping frames to the server. Use this to keep idle connections through certain load balancers alive longer.

Types

type RoundTripperConfig added in v0.20.0

type RoundTripperConfig struct {
	// TLS configuration used by the round tripper if UpgradeTransport not present.
	TLS *tls.Config
	// Proxier is a proxy function invoked on each request. Optional.
	Proxier func(*http.Request) (*url.URL, error)
	// PingPeriod is a period for sending SPDY Pings on the connection.
	// Optional.
	PingPeriod time.Duration
	// UpgradeTransport is a subtitute transport used for dialing. If set,
	// this field will be used instead of "TLS" and "Proxier" for connection creation.
	// Optional.
	UpgradeTransport http.RoundTripper
}

RoundTripperConfig is a set of options for an SpdyRoundTripper.

type SpdyRoundTripper

type SpdyRoundTripper struct {

	// Dialer is the dialer used to connect.  Used if non-nil.
	Dialer *net.Dialer
	// contains filtered or unexported fields
}

SpdyRoundTripper knows how to upgrade an HTTP request to one that supports multiplexed streams. After RoundTrip() is invoked, Conn will be set and usable. SpdyRoundTripper implements the UpgradeRoundTripper interface.

func NewRoundTripper

func NewRoundTripper(tlsConfig *tls.Config) (*SpdyRoundTripper, error)

NewRoundTripper creates a new SpdyRoundTripper that will use the specified tlsConfig.

func NewRoundTripperWithConfig added in v0.20.0

func NewRoundTripperWithConfig(cfg RoundTripperConfig) (*SpdyRoundTripper, error)

NewRoundTripperWithConfig creates a new SpdyRoundTripper with the specified configuration. Returns an error if the SpdyRoundTripper is misconfigured.

func NewRoundTripperWithProxy added in v0.19.0

func NewRoundTripperWithProxy(tlsConfig *tls.Config, proxier func(*http.Request) (*url.URL, error)) (*SpdyRoundTripper, error)

NewRoundTripperWithProxy creates a new SpdyRoundTripper that will use the specified tlsConfig and proxy func.

func (*SpdyRoundTripper) Dial

func (s *SpdyRoundTripper) Dial(req *http.Request) (net.Conn, error)

Dial implements k8s.io/apimachinery/pkg/util/net.Dialer.

func (*SpdyRoundTripper) NewConnection

func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connection, error)

NewConnection validates the upgrade response, creating and returning a new httpstream.Connection if there were no errors.

func (*SpdyRoundTripper) RoundTrip

func (s *SpdyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes the Request and upgrades it. After a successful upgrade, clients may call SpdyRoundTripper.Connection() to retrieve the upgraded connection.

func (*SpdyRoundTripper) TLSClientConfig

func (s *SpdyRoundTripper) TLSClientConfig() *tls.Config

TLSClientConfig implements pkg/util/net.TLSClientConfigHolder for proper TLS checking during proxying with a spdy roundtripper.

Jump to

Keyboard shortcuts

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