http2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolType = "http2"

	DefaultMaxFrameSize        uint32 = 16384
	DefaultMaxFieldValueLength uint32 = 4096

	ActionSendData              = "http2.send_data"
	ActionSendDataFrame         = "http2.send_data_frame"
	ActionSendHeadersFrame      = "http2.send_headers_frame"
	ActionSendPriorityFrame     = "http2.send_priority_frame"
	ActionSendRSTStreamFrame    = "http2.send_rst_stream_frame"
	ActionSendSettingsFrame     = "http2.send_settings_frame"
	ActionSendPushPromiseFrame  = "http2.send_push_promise_frame"
	ActionSendPingFrame         = "http2.send_ping_frame"
	ActionSendGoAwayFrame       = "http2.send_goaway_frame"
	ActionSendWindowUpdateFrame = "http2.send_window_update_frame"
	ActionSendContinuationFrame = "http2.send_continuation_frame"
	ActionSendStream            = "http2.send_stream"

	ActionWaitDataFrame       = "http2.wait_data_frame"
	ActionWaitHeadersFrame    = "http2.wait_headers_frame"
	ActionWaitRSTStreamFrame  = "http2.wait_rst_stream_frame"
	ActionWaitSettingsFrame   = "http2.wait_settings_frame"
	ActionWaitPingFrame       = "http2.wait_ping_frame"
	ActionWaitGoAwayFrame     = "http2.wait_goaway_frame"
	ActionWaitConnectionError = "http2.wait_connection_error"
	ActionWaitConnectionClose = "http2.wait_connection_close"
	ActionWaitStreamError     = "http2.wait_stream_error"
	ActionWaitStreamClose     = "http2.wait_stream_close"

	ActionTestDataLength = "http2.test_data_length"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConn

func NewConn(transport net.Conn) (*Conn, error)

func (*Conn) Init

func (conn *Conn) Init(param []byte) error

func (*Conn) MaxFrameSize

func (conn *Conn) MaxFrameSize() uint32

func (*Conn) Run

func (conn *Conn) Run(action string, param []byte) (interface{}, error)

func (*Conn) SetMode

func (conn *Conn) SetMode(server bool)

func (*Conn) SetTimeout

func (conn *Conn) SetTimeout(timeout time.Duration)

type Field

type Field struct {
	Name      string `json:"name"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive"`
	Omit      bool   `json:"omit"`
}

type InitParam

type InitParam struct {
	Handshake           bool      `json:"handshake"`
	Settings            []Setting `json:"settings"`
	MaxFieldValueLength uint32    `json:"max_field_value_length"`
}

func (*InitParam) Validate

func (p *InitParam) Validate() error

type Param

type Param interface {
	Validate() error
}

type Priority

type Priority struct {
	StreamDependency uint32 `json:"stream_dependency"`
	Exclusive        bool   `json:"exclusive"`
	Weight           uint8  `json:"weight"`
}

type SendContinuationFrameParam

type SendContinuationFrameParam struct {
	StreamID     uint32  `json:"stream_id"`
	EndHeaders   bool    `json:"end_headers"`
	HeaderFields []Field `json:"header_fields"`
}

func (*SendContinuationFrameParam) Validate

func (p *SendContinuationFrameParam) Validate() error

type SendDataFrameParam

type SendDataFrameParam struct {
	StreamID         uint32 `json:"stream_id"`
	EndStream        bool   `json:"end_stream"`
	PadLength        uint8  `json:"pad_length"`
	Data             string `json:"data"`
	DataLength       uint32 `json:"data_length"`
	FillMaxFrameSize bool   `json:"fill_max_frame_size"`
}

func (*SendDataFrameParam) Validate

func (p *SendDataFrameParam) Validate() error

type SendDataParam

type SendDataParam struct {
	Data []string `json:"data"`
}

func (*SendDataParam) Validate

func (p *SendDataParam) Validate() error

type SendGoAwayFrameParam

type SendGoAwayFrameParam struct {
	LastStreamID        uint32 `json:"last_stream_id"`
	ErrorCode           string `json:"error_code"`
	AdditionalDebugData string `json:"additional_debug_data"`
}

func (*SendGoAwayFrameParam) Validate

func (p *SendGoAwayFrameParam) Validate() error

type SendHeadersFrameParam

type SendHeadersFrameParam struct {
	StreamID          uint32    `json:"stream_id"`
	EndStream         bool      `json:"end_stream"`
	EndHeaders        bool      `json:"end_headers"`
	PadLength         uint8     `json:"pad_length"`
	HeaderFields      []Field   `json:"header_fields"`
	OmitDefaultFields bool      `json:"omit_default_fields"`
	FillMaxFrameSize  bool      `json:"fill_max_frame_size"`
	Priority          *Priority `json:"priority"`
}

func (*SendHeadersFrameParam) Validate

func (p *SendHeadersFrameParam) Validate() error

type SendPingFrameParam

type SendPingFrameParam struct {
	Ack  bool   `json:"ack"`
	Data string `json:"data"`
}

func (*SendPingFrameParam) Validate

func (p *SendPingFrameParam) Validate() error

type SendPriorityFrameParam

type SendPriorityFrameParam struct {
	Priority
	StreamID uint32 `json:"stream_id"`
}

func (*SendPriorityFrameParam) Validate

func (p *SendPriorityFrameParam) Validate() error

type SendPushPromiseFrameParam

type SendPushPromiseFrameParam struct {
	StreamID          uint32  `json:"stream_id"`
	EndHeaders        bool    `json:"end_headers"`
	PadLength         uint8   `json:"pad_length"`
	PromisedStreamID  uint32  `json:"promised_stream_id"`
	HeaderFields      []Field `json:"header_fields"`
	OmitDefaultFields bool    `json:"omit_default_fields"`
	FillMaxFrameSize  bool    `json:"fill_max_frame_size"`
}

func (*SendPushPromiseFrameParam) Validate

func (p *SendPushPromiseFrameParam) Validate() error

type SendRSTStreamFrameParam

type SendRSTStreamFrameParam struct {
	StreamID  uint32 `json:"stream_id"`
	ErrorCode string `json:"error_code"`
}

func (*SendRSTStreamFrameParam) Validate

func (p *SendRSTStreamFrameParam) Validate() error

type SendSettingsFrameParam

type SendSettingsFrameParam struct {
	Ack      bool      `json:"ack"`
	Settings []Setting `json:"settings"`
}

func (*SendSettingsFrameParam) Validate

func (p *SendSettingsFrameParam) Validate() error

type SendStreamParam

type SendStreamParam struct {
	InitialStreamID      uint32        `json:"initial_stream_id"`
	ConcurrentStreams    uint32        `json:"concurrent_streams"`
	MaxConcurrentStreams bool          `json:"max_concurrent_streams"`
	Frames               []StreamFrame `json:"frames"`
}

func (*SendStreamParam) Validate

func (p *SendStreamParam) Validate() error

type SendWindowUpdateFrameParam

type SendWindowUpdateFrameParam struct {
	StreamID            uint32 `json:"stream_id"`
	WindowSizeIncrement uint32 `json:"window_size_increment"`
}

func (*SendWindowUpdateFrameParam) Validate

func (p *SendWindowUpdateFrameParam) Validate() error

type Setting

type Setting struct {
	ID    string `json:"id"`
	Value uint32 `json:"value"`
}

type StreamFrame

type StreamFrame struct {
	Action string          `json:"action"`
	Param  json.RawMessage `json:"param"`
}

type TestDataLengthParam

type TestDataLengthParam struct {
	StreamID          uint32 `json:"stream_id"`
	MinimumDataLength uint32 `json:"minumum_data_length"`
}

func (*TestDataLengthParam) Validate

func (p *TestDataLengthParam) Validate() error

type WaitConnectionErrorParam

type WaitConnectionErrorParam struct {
	ErrorCode []string `json:"error_code"`
}

func (*WaitConnectionErrorParam) Validate

func (p *WaitConnectionErrorParam) Validate() error

type WaitDataFrameParam

type WaitDataFrameParam struct {
	StreamID   uint32  `json:"stream_id"`
	EndStream  *bool   `json:"end_stream"`
	Data       *string `json:"data"`
	DataLength *uint32 `json:"data_length"`
	PadLength  *uint8  `json:"pad_length"`
}

func (*WaitDataFrameParam) Validate

func (p *WaitDataFrameParam) Validate() error

type WaitGoAwayFrameParam

type WaitGoAwayFrameParam struct {
	LastStreamID uint32   `json:"last_stream_id"`
	ErrorCode    []string `json:"error_code"`
	DebugData    string   `json:"debug_data"`
}

func (*WaitGoAwayFrameParam) Validate

func (p *WaitGoAwayFrameParam) Validate() error

type WaitHeadersFrameParam

type WaitHeadersFrameParam struct {
	StreamID uint32 `json:"stream_id"`
}

func (*WaitHeadersFrameParam) Validate

func (p *WaitHeadersFrameParam) Validate() error

type WaitPingFrameParam

type WaitPingFrameParam struct {
	Ack  bool   `json:"ack"`
	Data string `json:"data"`
}

func (*WaitPingFrameParam) Validate

func (p *WaitPingFrameParam) Validate() error

type WaitRSTStreamFrameParam

type WaitRSTStreamFrameParam struct {
	StreamID  uint32   `json:"stream_id"`
	ErrorCode []string `json:"error_code"`
}

func (*WaitRSTStreamFrameParam) Validate

func (p *WaitRSTStreamFrameParam) Validate() error

type WaitSettingsFrameParam

type WaitSettingsFrameParam struct {
	Ack      bool              `json:"ack"`
	Settings map[string]uint32 `json:"settings"`
}

func (*WaitSettingsFrameParam) Validate

func (p *WaitSettingsFrameParam) Validate() error

type WaitStreamCloseParam

type WaitStreamCloseParam struct {
	StreamID uint32 `json:"stream_id"`
}

func (*WaitStreamCloseParam) Validate

func (p *WaitStreamCloseParam) Validate() error

type WaitStreamErrorParam

type WaitStreamErrorParam struct {
	StreamID  uint32   `json:"stream_id"`
	ErrorCode []string `json:"error_code"`
}

func (*WaitStreamErrorParam) Validate

func (p *WaitStreamErrorParam) Validate() error

Jump to

Keyboard shortcuts

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