spec2

package
v0.0.0-...-1814096 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWindowSize is the value of default connection window size.
	DefaultWindowSize = 65535
	// DefaultFrameSize is the value of default frame size.
	DefaultFrameSize = 16384
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn

	Settings map[http.SettingID]uint32
	Timeout  time.Duration
	Verbose  bool
	Closed   bool

	WindowUpdate bool
	WindowSize   map[uint32]int
	// contains filtered or unexported fields
}

Conn represent a HTTP/2 connection. This struct contains settings information, current window size, encoder of HPACK and frame encoder.

func Accept

func Accept(c *config.Config, baseConn net.Conn) (*Conn, error)

func Dial

func Dial(c *config.Config) (*Conn, error)

Dial connects to the server based on configuration.

func (*Conn) EncodeHeaders

func (conn *Conn) EncodeHeaders(headers []hpack.HeaderField) []byte

EncodeHeaders encodes header and returns encoded bytes. Conn retains encoding context and next call of EncodeHeaders will be performed using the same encoding context.

func (*Conn) Handshake

func (conn *Conn) Handshake() error

Handshake performs HTTP/2 handshake with the server.

func (*Conn) MaxFrameSize

func (conn *Conn) MaxFrameSize() int

MaxFrameSize returns value of Handshake performs HTTP/2 handshake with the server.

func (*Conn) ReadClientPreface

func (conn *Conn) ReadClientPreface() (string, error)

func (*Conn) ReadRequest

func (conn *Conn) ReadRequest() (*Request, error)

func (*Conn) Send

func (conn *Conn) Send(payload []byte) error

Send sends a byte sequense. This function is used to send a raw data in tests.

func (*Conn) SetMaxDynamicTableSize

func (conn *Conn) SetMaxDynamicTableSize(v uint32)

SetMaxDynamicTableSize changes the dynamic header table size to v.

func (*Conn) WaitEvent

func (conn *Conn) WaitEvent() Event

WaitEvent returns a event occured on connection. This function is used to wait the next event on the connection.

func (*Conn) WaitEventByType

func (conn *Conn) WaitEventByType(evt EventType) (Event, bool)

WaitEventByType returns a specified event occured on connection. This function is used to wait the next event that has specified type on the connection.

func (*Conn) WriteContinuation

func (conn *Conn) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error

WriteContinuation sends a CONTINUATION frame.

func (*Conn) WriteData

func (conn *Conn) WriteData(streamID uint32, endStream bool, data []byte) error

WriteData sends a DATA frame.

func (*Conn) WriteDataPadded

func (conn *Conn) WriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error

WriteDataPadded sends a DATA frame with padding.

func (*Conn) WriteGoAway

func (conn *Conn) WriteGoAway(maxStreamID uint32, code http.ErrCode, debugData []byte) error

WriteGoAway sends a GOAWAY frame.

func (*Conn) WriteHeaders

func (conn *Conn) WriteHeaders(p http.HeadersFrameParam) error

WriteHeaders sends a HEADERS frame.

func (*Conn) WritePing

func (conn *Conn) WritePing(ack bool, data [8]byte) error

WritePing sends a PING frame.

func (*Conn) WritePriority

func (conn *Conn) WritePriority(streamID uint32, p http.PriorityParam) error

WritePriority sends a PRIORITY frame.

func (*Conn) WritePushPromise

func (conn *Conn) WritePushPromise(p http.PushPromiseParam) error

WritePushPromise sends a PUSH_PROMISE frame.

func (*Conn) WriteRSTStream

func (conn *Conn) WriteRSTStream(streamID uint32, code http.ErrCode) error

WriteRSTStream sends a RST_STREAM frame.

func (*Conn) WriteRawFrame

func (conn *Conn) WriteRawFrame(t http.FrameType, flags http.Flags, streamID uint32, payload []byte) error

func (*Conn) WriteSettings

func (conn *Conn) WriteSettings(settings ...http.Setting) error

WriteSettings sends a SETTINGS frame.

func (*Conn) WriteSettingsAck

func (conn *Conn) WriteSettingsAck() error

WriteSettingsAck sends a SETTINGS frame with ACK flag.

func (*Conn) WriteSuccessResponse

func (conn *Conn) WriteSuccessResponse(streamID uint32, c *config.Config)

func (*Conn) WriteWindowUpdate

func (conn *Conn) WriteWindowUpdate(streamID, incr uint32) error

WriteWindowUpdate sends a WINDOW_UPDATE frame.

type Request

type Request struct {
	StreamID uint32
	Headers  []hpack.HeaderField
}

Jump to

Keyboard shortcuts

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