conn

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package conn provides shared HTTP/1.1 and HTTP/2 connection handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseH2

func CloseH2(state *H2State)

CloseH2 cleans up H2 state.

func ProcessH1

func ProcessH1(ctx context.Context, data []byte, state *H1State, handler stream.Handler,
	write func([]byte)) error

ProcessH1 processes incoming H1 data, parsing requests and calling the handler. The write callback is used to send response bytes back to the connection.

func ProcessH2

func ProcessH2(ctx context.Context, data []byte, state *H2State, _ stream.Handler,
	write func([]byte), cfg H2Config) error

ProcessH2 processes incoming H2 data. On first call, validates the client preface and sends server settings.

Types

type H1State

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

H1State holds per-connection H1 parsing state.

func NewH1State

func NewH1State() *H1State

NewH1State creates a new H1 connection state.

type H2Config

type H2Config struct {
	MaxConcurrentStreams uint32
	InitialWindowSize    uint32
	MaxFrameSize         uint32
}

H2Config holds H2 connection configuration.

type H2State

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

H2State holds per-connection H2 state.

func NewH2State

func NewH2State(handler stream.Handler, cfg H2Config, write func([]byte)) *H2State

NewH2State creates a new H2 connection state.

Jump to

Keyboard shortcuts

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