http3

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package http3 implements the HTTP/3 protocol.

This package is a work in progress. It is not ready for production usage. Its API is subject to change without notice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConn

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

A ClientConn is a client HTTP/3 connection.

Multiple goroutines may invoke methods on a ClientConn simultaneously.

func (*ClientConn) Close

func (cc *ClientConn) Close() error

Close closes the connection. Any in-flight requests are canceled. Close does not wait for the peer to acknowledge the connection closing.

func (*ClientConn) RoundTrip

func (cc *ClientConn) RoundTrip(req *http.Request) (_ *http.Response, err error)

RoundTrip sends a request on the connection.

type Server

type Server struct {
	// Handler to invoke for requests, http.DefaultServeMux if nil.
	Handler http.Handler

	// Config is the QUIC configuration used by the server.
	// The Config may be nil.
	//
	// ListenAndServe may clone and modify the Config.
	// The Config must not be modified after calling ListenAndServe.
	Config *quic.Config
	// contains filtered or unexported fields
}

A Server is an HTTP/3 server. The zero value for Server is a valid server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

ListenAndServe listens on the UDP network address addr and then calls Serve to handle requests on incoming connections.

func (*Server) Serve

func (s *Server) Serve(e *quic.Endpoint) error

Serve accepts incoming connections on the QUIC endpoint e, and handles requests from those connections.

type Transport

type Transport struct {
	// Endpoint is the QUIC endpoint used by connections created by the transport.
	// If unset, it is initialized by the first call to Dial.
	Endpoint *quic.Endpoint

	// Config is the QUIC configuration used for client connections.
	// The Config may be nil.
	//
	// Dial may clone and modify the Config.
	// The Config must not be modified after calling Dial.
	Config *quic.Config
	// contains filtered or unexported fields
}

A Transport is an HTTP/3 transport.

It does not manage a pool of connections, and therefore does not implement net/http.RoundTripper.

TODO: Provide a way to register an HTTP/3 transport with a net/http.Transport's connection pool.

func (*Transport) Dial

func (tr *Transport) Dial(ctx context.Context, target string) (*ClientConn, error)

Dial creates a new HTTP/3 client connection.

Jump to

Keyboard shortcuts

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