http3

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: 9 Imported by: 0

Documentation

Overview

Package http3 implements HTTP/3 protocol support for the tunnel library.

This package provides HTTP/3 protocol forwarding using QUIC as the underlying transport. HTTP/3 offers improved performance over HTTP/2 with reduced head-of-line blocking.

Example

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *quic.Config

DefaultConfig returns the default QUIC configuration for HTTP/3.

func IsHTTP3ClosedErr

func IsHTTP3ClosedErr(err error) bool

IsHTTP3ClosedErr returns true if the error indicates a normal HTTP/3 connection close.

Types

type Protocol

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

Protocol implements HTTP/3 protocol forwarding.

func New

func New(tlsConfig *tls.Config, quicConfig *quic.Config) *Protocol

New creates a new HTTP/3 protocol handler. The tlsConfig must have NextProtos set to []string{"h3"}.

func (*Protocol) Dial

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

Dial connects to an HTTP/3 server.

func (*Protocol) Forwarder

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

Forwarder returns the HTTP/3 forwarder.

func (*Protocol) Listen

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

Listen creates an HTTP/3 listener on the specified address. HTTP/3 uses UDP for transport.

func (*Protocol) Name

func (p *Protocol) Name() string

Name returns the protocol name.

type Server

type Server struct {
	*http3.Server
}

Server wraps http3.Server for convenience.

func NewServer

func NewServer(tlsConfig *tls.Config) *Server

NewServer creates a new HTTP/3 server.

Jump to

Keyboard shortcuts

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