http2

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package http2 implements HTTP/2 protocol support for the tunnel library.

This package provides HTTP/2 protocol forwarding with stream multiplexing support. It requires TLS configuration for secure connections.

Example

cfg := &tls.Config{
    Certificates: []tls.Certificate{cert},
}
p := http2.New(cfg)
listener, _ := p.Listen(":8443")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureServer

func ConfigureServer(srv *http2.Server)

ConfigureServer configures an HTTP/2 server.

func ConfigureTransport

func ConfigureTransport(tr *http2.Transport)

ConfigureTransport configures an HTTP/2 transport.

Types

type Protocol

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

Protocol implements HTTP/2 protocol forwarding.

func New

func New(tlsConfig *tls.Config) *Protocol

New creates a new HTTP/2 protocol handler. The tlsConfig is required for HTTP/2 connections.

func (*Protocol) Dial

func (p *Protocol) Dial(ctx context.Context, addr string) (net.Conn, error)

Dial connects to an HTTP/2 server.

func (*Protocol) Forwarder

func (p *Protocol) Forwarder() forward.Forwarder

Forwarder returns the HTTP/2 forwarder.

func (*Protocol) Listen

func (p *Protocol) Listen(addr string) (net.Listener, error)

Listen creates an HTTP/2 listener on the specified address. The listener accepts TLS connections with HTTP/2 support.

func (*Protocol) Name

func (p *Protocol) Name() string

Name returns the protocol name.

type Stream

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

Stream represents an HTTP/2 stream.

func (*Stream) ID

func (s *Stream) ID() uint32

ID returns the stream identifier.

func (*Stream) IsServerInitiated

func (s *Stream) IsServerInitiated() bool

IsServerInitiated returns true if the stream was initiated by the server.

Jump to

Keyboard shortcuts

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