http3

package
v0.0.0-...-9b8dde8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartTestServer

func StartTestServer(handler http.Handler) (addr string, shutdown func() error, err error)

StartTestServer launches a minimal HTTP/3 server backed by the provided handler. The returned address is suitable for use with net/http clients. The caller is responsible for invoking the shutdown function to release resources.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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