kubernetes: k8s.io/kubernetes/vendor/github.com/docker/spdystream Index | Files | Directories

package spdystream

import "k8s.io/kubernetes/vendor/github.com/docker/spdystream"


Package Files

connection.go handlers.go priority.go stream.go utils.go


const (
    QUEUE_SIZE    = 50


var (
    ErrInvalidStreamId   = errors.New("Invalid stream id")
    ErrTimeout           = errors.New("Timeout occured")
    ErrReset             = errors.New("Stream reset")
    ErrWriteClosedStream = errors.New("Write on closed stream")
var (
    DEBUG = os.Getenv("DEBUG")
var (
    ErrUnreadPartialData = errors.New("unread partial data")

func MirrorStreamHandler Uses

func MirrorStreamHandler(stream *Stream)

MirrorStreamHandler mirrors all streams.

func NoOpStreamHandler Uses

func NoOpStreamHandler(stream *Stream)

NoopStreamHandler does nothing when stream connects, most likely used with RejectAuthHandler which will not allow any streams to make it to the stream handler.

type AuthHandler Uses

type AuthHandler func(header http.Header, slot uint8, parent uint32) bool

type Connection Uses

type Connection struct {
    // contains filtered or unexported fields

func NewConnection Uses

func NewConnection(conn net.Conn, server bool) (*Connection, error)

NewConnection creates a new spdy connection from an existing network connection.

func (*Connection) Close Uses

func (s *Connection) Close() error

Closes spdy connection by sending GoAway frame and initiating shutdown

func (*Connection) CloseChan Uses

func (s *Connection) CloseChan() <-chan bool

func (*Connection) CloseWait Uses

func (s *Connection) CloseWait() error

CloseWait closes the connection and waits for shutdown to finish. Note the underlying network Connection is not closed until the end of shutdown.

func (*Connection) CreateStream Uses

func (s *Connection) CreateStream(headers http.Header, parent *Stream, fin bool) (*Stream, error)

CreateStream creates a new spdy stream using the parameters for creating the stream frame. The stream frame will be sent upon calling this function, however this function does not wait for the reply frame. If waiting for the reply is desired, use the stream Wait or WaitTimeout function on the stream returned by this function.

func (*Connection) FindStream Uses

func (s *Connection) FindStream(streamId uint32) *Stream

FindStream looks up the given stream id and either waits for the stream to be found or returns nil if the stream id is no longer valid.

func (*Connection) NotifyClose Uses

func (s *Connection) NotifyClose(c chan<- *Stream, timeout time.Duration)

NotifyClose registers a channel to be called when the remote peer inidicates connection closure. The last stream to be received by the remote will be sent on the channel. The notify timeout will determine the duration between go away received and the connection being closed.

func (*Connection) PeekNextStreamId Uses

func (s *Connection) PeekNextStreamId() spdy.StreamId

PeekNextStreamId returns the next sequential id and keeps the next id untouched

func (*Connection) Ping Uses

func (s *Connection) Ping() (time.Duration, error)

Ping sends a ping frame across the connection and returns the response time

func (*Connection) Serve Uses

func (s *Connection) Serve(newHandler StreamHandler)

Serve handles frames sent from the server, including reply frames which are needed to fully initiate connections. Both clients and servers should call Serve in a separate goroutine before creating streams.

func (*Connection) SetCloseTimeout Uses

func (s *Connection) SetCloseTimeout(timeout time.Duration)

SetCloseTimeout sets the amount of time close will wait for streams to finish before terminating the underlying network connection. Setting the timeout to 0 will cause close to wait forever, which is the default.

func (*Connection) SetIdleTimeout Uses

func (s *Connection) SetIdleTimeout(timeout time.Duration)

SetIdleTimeout sets the amount of time the connection may sit idle before it is forcefully terminated.

func (*Connection) Wait Uses

func (s *Connection) Wait(waitTimeout time.Duration) error

Wait waits for the connection to finish shutdown or for the wait timeout duration to expire. This needs to be called either after Close has been called or the GOAWAYFRAME has been received. If the wait timeout is 0, this function will block until shutdown finishes. If wait is never called and a shutdown error occurs, that error will be logged as an unhandled error.

type PriorityFrameQueue Uses

type PriorityFrameQueue struct {
    // contains filtered or unexported fields

func NewPriorityFrameQueue Uses

func NewPriorityFrameQueue(size int) *PriorityFrameQueue

func (*PriorityFrameQueue) Drain Uses

func (q *PriorityFrameQueue) Drain()

func (*PriorityFrameQueue) Pop Uses

func (q *PriorityFrameQueue) Pop() spdy.Frame

func (*PriorityFrameQueue) Push Uses

func (q *PriorityFrameQueue) Push(frame spdy.Frame, priority uint8)

type Stream Uses

type Stream struct {
    // contains filtered or unexported fields

func (*Stream) Cancel Uses

func (s *Stream) Cancel() error

Cancel sends a reset frame with the status canceled. This can be used at any time by the creator of the Stream to indicate the stream is no longer needed.

func (*Stream) Close Uses

func (s *Stream) Close() error

Close closes the stream by sending an empty data frame with the finish flag set, indicating this side is finished with the stream.

func (*Stream) CreateSubStream Uses

func (s *Stream) CreateSubStream(headers http.Header, fin bool) (*Stream, error)

CreateSubStream creates a stream using the current as the parent

func (*Stream) Headers Uses

func (s *Stream) Headers() http.Header

Headers returns the headers used to create the stream

func (*Stream) Identifier Uses

func (s *Stream) Identifier() uint32

Identifier returns a 32 bit identifier for the stream

func (*Stream) IsFinished Uses

func (s *Stream) IsFinished() bool

IsFinished returns whether the stream has finished sending data

func (*Stream) LocalAddr Uses

func (s *Stream) LocalAddr() net.Addr

func (*Stream) Parent Uses

func (s *Stream) Parent() *Stream

Parent returns the parent stream

func (*Stream) Read Uses

func (s *Stream) Read(p []byte) (n int, err error)

Read reads bytes from a stream, a single read will never get more than what is sent on a single data frame, but a multiple calls to read may get data from the same data frame.

func (*Stream) ReadData Uses

func (s *Stream) ReadData() ([]byte, error)

ReadData reads an entire data frame and returns the byte array from the data frame. If there is unread data from the result of a Read call, this function will return an ErrUnreadPartialData.

func (*Stream) ReceiveHeader Uses

func (s *Stream) ReceiveHeader() (http.Header, error)

ReceiveHeader receives a header sent on the other side of the stream. This function will block until a header is received or stream is closed.

func (*Stream) Refuse Uses

func (s *Stream) Refuse() error

Refuse sends a reset frame with the status refuse, only valid to be called once when handling a new stream. This may be used to indicate that a stream is not allowed when http status codes are not being used.

func (*Stream) RemoteAddr Uses

func (s *Stream) RemoteAddr() net.Addr

func (*Stream) Reset Uses

func (s *Stream) Reset() error

Reset sends a reset frame, putting the stream into the fully closed state.

func (*Stream) SendHeader Uses

func (s *Stream) SendHeader(headers http.Header, fin bool) error

SendHeader sends a header frame across the stream

func (*Stream) SendReply Uses

func (s *Stream) SendReply(headers http.Header, fin bool) error

SendReply sends a reply on a stream, only valid to be called once when handling a new stream

func (*Stream) SetDeadline Uses

func (s *Stream) SetDeadline(t time.Time) error

func (*Stream) SetPriority Uses

func (s *Stream) SetPriority(priority uint8)

SetPriority sets the stream priority, does not affect the remote priority of this stream after Open has been called. Valid values are 0 through 7, 0 being the highest priority and 7 the lowest.

func (*Stream) SetReadDeadline Uses

func (s *Stream) SetReadDeadline(t time.Time) error

func (*Stream) SetWriteDeadline Uses

func (s *Stream) SetWriteDeadline(t time.Time) error

func (*Stream) String Uses

func (s *Stream) String() string

String returns the string version of stream using the streamId to uniquely identify the stream

func (*Stream) Wait Uses

func (s *Stream) Wait() error

Wait waits for the stream to receive a reply.

func (*Stream) WaitTimeout Uses

func (s *Stream) WaitTimeout(timeout time.Duration) error

WaitTimeout waits for the stream to receive a reply or for timeout. When the timeout is reached, ErrTimeout will be returned.

func (*Stream) Write Uses

func (s *Stream) Write(data []byte) (n int, err error)

Write writes bytes to a stream, calling write data for each call.

func (*Stream) WriteData Uses

func (s *Stream) WriteData(data []byte, fin bool) error

WriteData writes data to stream, sending a dataframe per call

type StreamHandler Uses

type StreamHandler func(stream *Stream)


spdyPackage spdy implements the SPDY protocol (currently SPDY/3), described in http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3.

Package spdystream imports 11 packages (graph). Updated 2018-07-23. Refresh now. Tools for package owners.