Documentation
¶
Overview ¶
Package proxyquic implements VORTEX's QUIC / HTTP/3 transport (build plan M2.3) on top of github.com/quic-go/quic-go. It serves the same proxyhttp Router over HTTP/3 and provides a dual-stack listener that runs QUIC (UDP) alongside the TCP HTTP/1.1+HTTP/2 server, degrading to TCP-only when QUIC cannot bind.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DualStack ¶
type DualStack struct {
// contains filtered or unexported fields
}
DualStack runs a QUIC/HTTP3 transport alongside a TCP HTTP/1.1+HTTP/2 server, sharing one Router. TCP is required; if QUIC cannot bind, the server degrades to TCP-only. TCP responses carry an Alt-Svc header advertising HTTP/3 so capable clients upgrade on their next connection.
func NewDualStack ¶
func NewDualStack(cfg DualStackConfig) (*DualStack, error)
NewDualStack validates cfg and constructs a DualStack.
func (*DualStack) Addr ¶
Addr returns the bound TCP address (useful when the configured port was 0).
func (*DualStack) ListenAndServe ¶
ListenAndServe starts both listeners. TCP is required: if it fails to bind, ListenAndServe returns its error. QUIC is best-effort: a QUIC bind failure is logged and the server continues TCP-only. It returns nil once both (or just TCP) have stopped after ctx cancellation.
func (*DualStack) Stats ¶
func (d *DualStack) Stats() DualStackStats
Stats returns aggregated QUIC + TCP statistics.
type DualStackConfig ¶
type DualStackConfig struct {
// Addr is the shared listen address, e.g. ":443".
Addr string
// TLSConfig is used by both the TCP and QUIC listeners.
TLSConfig *tls.Config
// Router handles requests on both transports.
Router *proxyhttp.Router
// QUICConfig customizes the QUIC transport. Addr/TLSConfig/Router are
// filled from the DualStack fields if unset.
QUICConfig QUICConfig
// Logger receives degradation warnings; defaults to slog.Default.
Logger *slog.Logger
}
DualStackConfig configures a server that listens on both QUIC (UDP) and TCP.
type DualStackStats ¶
type DualStackStats struct {
QUIC QUICStats
TCP proxyhttp.ServerStats
QUICAvailable bool
}
DualStackStats aggregates QUIC and TCP statistics.
type QUICConfig ¶
type QUICConfig struct {
// Addr is the UDP listen address, e.g. ":443". Required.
Addr string
// TLSConfig is required — QUIC mandates TLS 1.3.
TLSConfig *tls.Config
// Router handles requests received over HTTP/3. Required.
Router *proxyhttp.Router
// MaxStreams is the max concurrent bidirectional streams per connection.
// Default 100.
MaxStreams int64
// IdleTimeout is the max idle duration before a connection is closed.
// Default 30s. KeepAlive is set to half this.
IdleTimeout time.Duration
// Enable0RTT allows 0-RTT session resumption. Default true.
Enable0RTT bool
}
QUICConfig configures a QUIC/HTTP3 Transport.
type QUICStats ¶
type QUICStats struct {
ActiveConns int64
TotalConns int64
ZeroRTTAccepted int64 // stub — incremented when 0-RTT accounting is wired
}
QUICStats is a snapshot of QUIC transport counters.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport serves the configured Router over HTTP/3.
func NewTransport ¶
func NewTransport(cfg QUICConfig) (*Transport, error)
NewTransport validates cfg and constructs a Transport.
func (*Transport) ListenAndServe ¶
ListenAndServe binds the UDP socket and serves HTTP/3 until ctx is cancelled, then closes the server. It returns nil on clean shutdown and an error only on an unexpected bind/serve failure.