Documentation
¶
Overview ¶
Package n4 serves HTTP/3 over an engine's admitted peer graph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
NewServer constructs HTTP/3 admission around e and h. Serve it with srv.Serve(e.PacketConn()). Connections without live leases close immediately; each request checks the lease again and returns 403 after revocation. Validate p first. An invalid policy closes connections and refuses requests.
func PeerFromContext ¶
PeerFromContext returns the admitted connection's node key. Contexts outside NewServer return a zero key and false; callers still check current authority.
Types ¶
type LossProfile ¶
type LossProfile string
LossProfile selects "both", "no_lower", "loss_thresh", or "off". Unknown profiles are refused by Policy.Validate.
type Policy ¶
type Policy struct {
Loss LossProfile
InitialStreamWindow, StreamWindow uint64
ACKDecimation bool
ScaledGapLimit bool
}
Policy selects QUIC loss handling and receive credit. A zero StreamWindow retains default credit; otherwise InitialStreamWindow is positive and no greater than StreamWindow. Connection credit is 1.5 times stream credit.
func DefaultClientPolicy ¶
func DefaultClientPolicy() Policy
DefaultClientPolicy returns BBRv3 with both loss switches, ACK decimation, scaled gaps and stream credit growing from 4 MiB to 128 MiB.
func DefaultServerPolicy ¶
func DefaultServerPolicy() Policy
DefaultServerPolicy returns both loss switches and scaled gaps, default receive credit and no ACK decimation.
func (Policy) QUICConfig ¶
QUICConfig returns a fresh BBRv3 configuration. Call Validate before using caller-supplied policies; zero credit fields retain quic-go's defaults.
type Transport ¶
type Transport struct {
Engine *engine.Engine
Policy Policy
Resolve func(host string) (k protocol.NodeKey, spkiSHA256Base64 string, ok bool)
// contains filtered or unexported fields
}
Transport dials resolved node identities using one shared QUIC transport. Configure fields before use and keep them unchanged. Resolve is concurrent and supplies an already trusted SPKI pin; identity is the node key and pin. A Transport must not be copied after use. Close leaves its engine owned by the caller. Requests carry their original headers without added credentials.
func (*Transport) Close ¶
Close closes all host transports and the shared QUIC transport, returning their joined errors. It is idempotent and never closes the engine's adapter.
func (*Transport) CloseIdleConnections ¶
func (t *Transport) CloseIdleConnections()
CloseIdleConnections releases idle HTTP/3 connections for every resolved host. Active requests and the shared engine remain available.
func (*Transport) RoundTrip ¶
RoundTrip sends an HTTPS request to a resolved peer. Unresolved hosts fail before socket access. A bodyless GET or HEAD whose dial or handshake fails retries once only after Resolve supplies a different node key or SPKI pin, within the handshake timeout. That includes the re-dial that follows a cached connection found dead. A request that fails on an established connection returns its error at once. Other requests are never replayed by this transport.