h2c

package
v0.0.0-...-faeea24 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func NewConnection

func NewConnection(c net.Conn) *Connection

func (*Connection) AssignStreamID

func (c *Connection) AssignStreamID(s *Stream) func()

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) GoAway

func (c *Connection) GoAway(code http2.ErrCode) error

func (*Connection) GoAwayDebug

func (c *Connection) GoAwayDebug(code http2.ErrCode, debug []byte) error

func (*Connection) Handshake

func (c *Connection) Handshake() error

func (*Connection) ReleaseStreamID

func (c *Connection) ReleaseStreamID(s *Stream)

func (*Connection) ShouldProcess

func (c *Connection) ShouldProcess(streamID uint32) bool

ShouldProcess checks if stream should be retried on a new connection if some error occurred

func (*Connection) Stream

func (c *Connection) Stream() (*Stream, error)

type InflowCtrl

type InflowCtrl interface {
	ResetInitialBalance(sz uint32) bool
	CheckAndPay(sz uint32) bool
	Refund(sz uint32) uint32
}

type OutflowCtrl

type OutflowCtrl interface {
	ResetInitialBalance(sz uint32) bool
	Available() bool
	Pay(sz uint32) uint32
	Refund(sz uint32) bool
}

type Stream

type Stream struct {
	*Connection
	// contains filtered or unexported fields
}

func (*Stream) Close

func (s *Stream) Close() error

func (*Stream) CloseWithError

func (s *Stream) CloseWithError(err error) error

func (*Stream) HandleWrite

func (s *Stream) HandleWrite(ctx context.Context, writeAction func(context.Context) error) (err error)

HandleWrite handles errors and timeouts from [WriteHeaders] and [WriteRequestBody]

func (*Stream) ID

func (s *Stream) ID() uint32

func (*Stream) Read

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

func (*Stream) ReadHeaders

func (s *Stream) ReadHeaders(ctx context.Context, headersCb func(k, v string) error) error

TODO: maybe change this api

func (*Stream) Reset

func (s *Stream) Reset(code http2.ErrCode, isReceived bool) (err error)

func (*Stream) ResponseBodyStream

func (s *Stream) ResponseBodyStream(ctx context.Context) io.ReadCloser

TODO: maybe change this api

func (*Stream) Valid

func (s *Stream) Valid() bool

func (*Stream) Write

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

func (*Stream) WriteHeaders

func (s *Stream) WriteHeaders(ctx context.Context, enumHeaders func(func(k, v string)), last bool) error

TODO: maybe change this api

func (*Stream) WriteRequestBody

func (s *Stream) WriteRequestBody(ctx context.Context, data io.Reader, sz int64, last bool) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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