spdy3

package
v0.0.0-...-431b911 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package spdy3 contains functionality for SPDY/3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextProto

func NextProto(s *http.Server, tlsConn *tls.Conn, handler http.Handler)

NextProto is intended for use in http.Server.TLSNextProto, using SPDY/3 for the connection.

func NextProto1

func NextProto1(s *http.Server, tlsConn *tls.Conn, handler http.Handler)

NextProto1 is intended for use in http.Server.TLSNextProto, using SPDY/3.1 for the connection.

Types

type Conn

type Conn struct {
	PushReceiver common.Receiver // Receiver to call for server Pushes.
	Subversion   int             // SPDY 3 subversion (eg 0 for SPDY/3, 1 for SPDY/3.1).
	// contains filtered or unexported fields
}

Conn is a spdy.Conn implementing SPDY/3. This is used in both servers and clients, and is created with either NewServerConn, or NewClientConn.

func NewConn

func NewConn(conn net.Conn, server *http.Server, subversion int) *Conn

NewConn produces an initialised spdy3 connection.

func (*Conn) Close

func (c *Conn) Close() (err error)

Close ends the connection, cleaning up relevant resources. Close can be called multiple times safely.

func (*Conn) CloseNotify

func (c *Conn) CloseNotify() <-chan bool

func (*Conn) Closed

func (c *Conn) Closed() bool

Closed indicates whether the connection has been closed.

func (*Conn) Conn

func (c *Conn) Conn() net.Conn

func (*Conn) Ping

func (c *Conn) Ping() (<-chan bool, error)

Ping is used by spdy.PingServer and spdy.PingClient to send SPDY PINGs.

func (*Conn) Push

func (c *Conn) Push(resource string, origin common.Stream) (common.PushStream, error)

Push is used to issue a server push to the client. Note that this cannot be performed by clients.

func (*Conn) Request

func (c *Conn) Request(request *http.Request, receiver common.Receiver, priority common.Priority) (common.Stream, error)

Request is used to make a client request.

func (*Conn) RequestResponse

func (c *Conn) RequestResponse(request *http.Request, receiver common.Receiver, priority common.Priority) (*http.Response, error)

func (*Conn) Run

func (c *Conn) Run() error

func (*Conn) SetFlowControl

func (c *Conn) SetFlowControl(f common.FlowControl)

func (*Conn) SetReadTimeout

func (c *Conn) SetReadTimeout(d time.Duration)

func (*Conn) SetWriteTimeout

func (c *Conn) SetWriteTimeout(d time.Duration)

type DefaultFlowControl

type DefaultFlowControl uint32

func (DefaultFlowControl) InitialWindowSize

func (f DefaultFlowControl) InitialWindowSize() uint32

func (DefaultFlowControl) ReceiveData

func (f DefaultFlowControl) ReceiveData(_ common.StreamID, initialWindowSize uint32, newWindowSize int64) uint32

type PushStream

type PushStream struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PushStream is a structure that implements the Stream and PushWriter interfaces. this is used for performing server pushes.

func NewPushStream

func NewPushStream(conn *Conn, streamID common.StreamID, origin common.Stream, output chan<- common.Frame) *PushStream

func (*PushStream) AddFlowControl

func (s *PushStream) AddFlowControl(f common.FlowControl)

AddFlowControl initialises flow control for the Stream. If the Stream is running at an older SPDY version than SPDY/3, the flow control has no effect. Multiple calls to AddFlowControl are safe.

func (*PushStream) Close

func (p *PushStream) Close() error

func (*PushStream) CloseNotify

func (p *PushStream) CloseNotify() <-chan bool

func (*PushStream) Conn

func (p *PushStream) Conn() common.Conn

func (*PushStream) Finish

func (p *PushStream) Finish()

func (*PushStream) Header

func (p *PushStream) Header() http.Header

func (*PushStream) ReceiveFrame

func (p *PushStream) ReceiveFrame(frame common.Frame) error

func (*PushStream) Run

func (p *PushStream) Run() error

func (*PushStream) State

func (p *PushStream) State() *common.StreamState

func (*PushStream) StreamID

func (p *PushStream) StreamID() common.StreamID

func (*PushStream) Write

func (p *PushStream) Write(inputData []byte) (int, error)

Write is used for sending data in the push.

func (*PushStream) WriteHeader

func (p *PushStream) WriteHeader(int)

WriteHeader is provided to satisfy the Stream interface, but has no effect.

type RequestStream

type RequestStream struct {
	sync.Mutex
	Request  *http.Request
	Receiver common.Receiver
	// contains filtered or unexported fields
}

RequestStream is a structure that implements the Stream and ResponseWriter interfaces. This is used for responding to client requests.

func NewRequestStream

func NewRequestStream(conn *Conn, streamID common.StreamID, output chan<- common.Frame) *RequestStream

func (*RequestStream) AddFlowControl

func (s *RequestStream) AddFlowControl(f common.FlowControl)

AddFlowControl initialises flow control for the Stream. If the Stream is running at an older SPDY version than SPDY/3, the flow control has no effect. Multiple calls to AddFlowControl are safe.

func (*RequestStream) Close

func (s *RequestStream) Close() error

Close is used to stop the stream safely.

func (*RequestStream) CloseNotify

func (s *RequestStream) CloseNotify() <-chan bool

func (*RequestStream) Conn

func (s *RequestStream) Conn() common.Conn

func (*RequestStream) Header

func (s *RequestStream) Header() http.Header

func (*RequestStream) ReceiveFrame

func (s *RequestStream) ReceiveFrame(frame common.Frame) error

func (*RequestStream) Run

func (s *RequestStream) Run() error

run is the main control path of the stream. Data is recieved, processed, and then the stream is cleaned up and closed.

func (*RequestStream) State

func (s *RequestStream) State() *common.StreamState

func (*RequestStream) StreamID

func (s *RequestStream) StreamID() common.StreamID

func (*RequestStream) Write

func (s *RequestStream) Write(inputData []byte) (int, error)

Write is one method with which request data is sent.

func (*RequestStream) WriteHeader

func (s *RequestStream) WriteHeader(int)

WriteHeader is used to set the HTTP status code.

type ResponseStream

type ResponseStream struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ResponseStream is a structure that implements the Stream interface. This is used for responding to client requests.

func NewResponseStream

func NewResponseStream(conn *Conn, frame *frames.SYN_STREAM, output chan<- common.Frame, handler http.Handler, request *http.Request) *ResponseStream

func (*ResponseStream) AddFlowControl

func (s *ResponseStream) AddFlowControl(f common.FlowControl)

AddFlowControl initialises flow control for the Stream. If the Stream is running at an older SPDY version than SPDY/3, the flow control has no effect. Multiple calls to AddFlowControl are safe.

func (*ResponseStream) Close

func (s *ResponseStream) Close() error

func (*ResponseStream) CloseNotify

func (s *ResponseStream) CloseNotify() <-chan bool

func (*ResponseStream) Conn

func (s *ResponseStream) Conn() common.Conn

func (*ResponseStream) Header

func (s *ResponseStream) Header() http.Header

func (*ResponseStream) Priority

func (s *ResponseStream) Priority() common.Priority

func (*ResponseStream) ReceiveFrame

func (s *ResponseStream) ReceiveFrame(frame common.Frame) error

func (*ResponseStream) Run

func (s *ResponseStream) Run() error

run is the main control path of the stream. It is prepared, the registered handler is called, and then the stream is cleaned up and closed.

func (*ResponseStream) State

func (s *ResponseStream) State() *common.StreamState

func (*ResponseStream) StreamID

func (s *ResponseStream) StreamID() common.StreamID

func (*ResponseStream) Write

func (s *ResponseStream) Write(inputData []byte) (int, error)

Write is the main method with which data is sent.

func (*ResponseStream) WriteHeader

func (s *ResponseStream) WriteHeader(code int)

WriteHeader is used to set the HTTP status code.

Directories

Path Synopsis
Package frames contains an implementation of the SPDY/3 frames.
Package frames contains an implementation of the SPDY/3 frames.

Jump to

Keyboard shortcuts

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