Documentation ¶
Index ¶
- Constants
- Variables
- func MirrorStreamHandler(stream *Stream)
- func NoOpStreamHandler(stream *Stream)
- type AuthHandler
- type Connection
- type PriorityFrameQueue
- type Stream
- func (s *Stream) Cancel() error
- func (s *Stream) Close() error
- func (s *Stream) CreateSubStream(headers http.Header, fin bool) (*Stream, error)
- func (s *Stream) Headers() http.Header
- func (s *Stream) IsFinished() bool
- func (s *Stream) LocalAddr() net.Addr
- func (s *Stream) Parent() *Stream
- func (s *Stream) Read(p []byte) (n int, err error)
- func (s *Stream) ReceiveHeader() (http.Header, error)
- func (s *Stream) Refuse() error
- func (s *Stream) RemoteAddr() net.Addr
- func (s *Stream) Reset() error
- func (s *Stream) SendHeader(headers http.Header, fin bool) error
- func (s *Stream) SendReply(headers http.Header, fin bool) error
- func (s *Stream) SetDeadline(t time.Time) error
- func (s *Stream) SetPriority(priority uint8)
- func (s *Stream) SetReadDeadline(t time.Time) error
- func (s *Stream) SetWriteDeadline(t time.Time) error
- func (s *Stream) String() string
- func (s *Stream) Wait() error
- func (s *Stream) WaitTimeout(timeout time.Duration) error
- func (s *Stream) Write(data []byte) (n int, err error)
- func (s *Stream) WriteData(data []byte, fin bool) error
- type StreamHandler
Constants ¶
const ( FRAME_WORKERS = 5 QUEUE_SIZE = 50 )
Variables ¶
Functions ¶
func MirrorStreamHandler ¶
func MirrorStreamHandler(stream *Stream)
MirrorStreamHandler mirrors all streams.
func NoOpStreamHandler ¶
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.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(conn net.Conn, server bool) (*Connection, error)
NewConnection creates a new spdy connection from an existing network connection.
func (*Connection) Close ¶
func (s *Connection) Close() error
Closes spdy connection, including network connection used to create the spdy connection.
func (*Connection) CreateStream ¶
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) Ping ¶
func (s *Connection) Ping() (time.Duration, error)
Ping sends a ping frame across the connection and returns the response time
func (*Connection) Serve ¶
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.
type PriorityFrameQueue ¶
type PriorityFrameQueue struct {
// contains filtered or unexported fields
}
func NewPriorityFrameQueue ¶
func NewPriorityFrameQueue(size int) *PriorityFrameQueue
func (*PriorityFrameQueue) Drain ¶
func (q *PriorityFrameQueue) Drain()
func (*PriorityFrameQueue) Pop ¶
func (q *PriorityFrameQueue) Pop() spdy.Frame
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) Cancel ¶
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 ¶
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 ¶
CreateSubStream creates a stream using the current as the parent
func (*Stream) IsFinished ¶
IsFinished returns whether the stream has finished sending data
func (*Stream) Read ¶
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) ReceiveHeader ¶
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 ¶
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 ¶
func (*Stream) SendHeader ¶
SendHeader sends a header frame across the stream
func (*Stream) SendReply ¶
SendReply sends a reply on a stream, only valid to be called once when handling a new stream
func (*Stream) SetPriority ¶
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) String ¶
String returns the string version of stream using the streamId to uniquely identify the stream
func (*Stream) WaitTimeout ¶
WaitTimeout waits for the stream to receive a reply or for timeout. When the timeout is reached, ErrTimeout will be returned.
type StreamHandler ¶
type StreamHandler func(stream *Stream)