spdy

package module
v0.0.0-...-1a947ec Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2012 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeSynStream    = 0x0001
	TypeSynReply     = 0x0002
	TypeRstStream    = 0x0003
	TypeSettings     = 0x0004
	TypeNoop         = 0x0005
	TypePing         = 0x0006
	TypeGoaway       = 0x0007
	TypeHeaders      = 0x0008
	TypeWindowUpdate = 0x0009
)

Control frame type constants

View Source
const (
	FlagFin                              = 0x01
	FlagUnidirectional                   = 0x02
	FlagClearPreviouslyPersistedSettings = 0x01
)

Frame flag constants

View Source
const MaxDataLength = 1<<24 - 1

MaxDataLength is the maximum number of bytes that can be stored in one frame.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, handler http.Handler) error

ListenAndServe creates a new Server that serves on the given address. If the handler is nil, then http.DefaultServeMux is used.

func ListenAndServeTLS

func ListenAndServeTLS(addr string, certFile, keyFile string, handler http.Handler) (err error)

ListenAndServeTLS acts like ListenAndServe except it uses TLS.

Types

type ControlFrame

type ControlFrame struct {
	Type  ControlFrameType
	Flags FrameFlags
	Data  []byte
}

ControlFrame holds a generic control frame.

func (ControlFrame) GetData

func (f ControlFrame) GetData() []byte

func (ControlFrame) GetFlags

func (f ControlFrame) GetFlags() FrameFlags

func (ControlFrame) WriteTo

func (f ControlFrame) WriteTo(w io.Writer) (n int64, err error)

type ControlFrameType

type ControlFrameType uint16

func (ControlFrameType) String

func (t ControlFrameType) String() string

type DataFrame

type DataFrame struct {
	StreamID uint32
	Flags    FrameFlags
	Data     []byte
}

A DataFrame stores a data frame and its associated metadata.

func (DataFrame) GetData

func (f DataFrame) GetData() []byte

func (DataFrame) GetFlags

func (f DataFrame) GetFlags() FrameFlags

func (DataFrame) WriteTo

func (f DataFrame) WriteTo(w io.Writer) (n int64, err error)

type Frame

type Frame interface {
	io.WriterTo // WriteTo method writes the packet in SPDY format.
	GetFlags() FrameFlags
	GetData() []byte
}

A Frame is the low-level construct passed over a SPDY connection.

func ReadFrame

func ReadFrame(r io.Reader) (f Frame, err error)

ReadFrame reads an entire frame into memory.

type FrameFlags

type FrameFlags uint8

type HeaderReader

type HeaderReader struct {
	// contains filtered or unexported fields
}

A HeaderReader reads zlib-compressed headers from discontiguous sources.

func NewHeaderReader

func NewHeaderReader() (hr *HeaderReader)

NewHeaderReader creates a HeaderReader with the initial dictionary.

func (*HeaderReader) Decode

func (hr *HeaderReader) Decode(data []byte) (h http.Header, err error)

Decode reads a set of headers from a block of bytes.

func (*HeaderReader) ReadHeader

func (hr *HeaderReader) ReadHeader(r io.Reader) (h http.Header, err error)

ReadHeader reads a set of headers from a reader.

type HeaderWriter

type HeaderWriter struct {
	// contains filtered or unexported fields
}

HeaderWriter will write zlib-compressed headers on different streams.

func NewHeaderWriter

func NewHeaderWriter(level int) (hw *HeaderWriter)

NewHeaderWriter creates a HeaderWriter ready to compress headers.

func (*HeaderWriter) Encode

func (hw *HeaderWriter) Encode(h http.Header) (data []byte)

Encode returns a compressed header block.

func (*HeaderWriter) WriteHeader

func (hw *HeaderWriter) WriteHeader(w io.Writer, h http.Header) (err error)

WriteHeader writes a header block directly to an output.

type Server

type Server struct {
	Addr    string
	Handler http.Handler
}

A Server handles incoming SPDY connections with HTTP handlers.

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe() error

ListenAndServe services SPDY requests on the given address. If the handler is nil, then http.DefaultServeMux is used.

func (*Server) Serve

func (srv *Server) Serve(l net.Listener) error

ListenAndServe services SPDY requests using the given listener. If the handler is nil, then http.DefaultServeMux is used.

Jump to

Keyboard shortcuts

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