Documentation
¶
Overview ¶
Package http3 contains optimized HTTP/3 wire primitives used by the Go+ HTTP transport. The primitives deliberately avoid mutable QPACK state, so a field section can be produced concurrently without blocking on an encoder stream.
Index ¶
- Variables
- func AppendDataFrameHeader(dst []byte, payloadLength uint64) ([]byte, error)
- func AppendFieldSection(dst []byte, fields []HeaderField) ([]byte, error)
- func AppendFrameHeader(dst []byte, frameType, payloadLength uint64) ([]byte, error)
- func AppendHeadersFrameHeader(dst []byte, payloadLength uint64) ([]byte, error)
- func EncodeDataFrameHeader(dst *[9]byte, payloadLength uint64) int
- func EncodeHeadersFrameHeader(dst *[9]byte, payloadLength uint64) int
- type HeaderField
- type NativeServer
- type QUICBackend
- type QUICGoServer
- type RFC9000Config
- type Transport
- type XNetServer
Constants ¶
This section is empty.
Variables ¶
var ErrFieldSectionTooLarge = errors.New("http3: field section too large")
Functions ¶
func AppendDataFrameHeader ¶
AppendDataFrameHeader appends a DATA frame header without dispatching on a runtime frame type.
func AppendFieldSection ¶
func AppendFieldSection(dst []byte, fields []HeaderField) ([]byte, error)
AppendFieldSection appends a complete QPACK field section using only the static table and literal representations. It never mutates shared state and is therefore safe to call concurrently when dst is not shared.
func AppendFrameHeader ¶
AppendFrameHeader appends an RFC 9114 frame type and payload length.
func AppendHeadersFrameHeader ¶
AppendHeadersFrameHeader appends a HEADERS frame header without dispatching on a runtime frame type.
func EncodeDataFrameHeader ¶
EncodeDataFrameHeader writes a DATA frame header into dst and returns its length. payloadLength must be less than 2^62.
func EncodeHeadersFrameHeader ¶
EncodeHeadersFrameHeader writes a HEADERS frame header into dst and returns its length. payloadLength must be less than 2^62. Fixed-buffer encoding is intended for QUIC writers that already own per-stream scratch space.
Types ¶
type HeaderField ¶
HeaderField is one QPACK field line.
type NativeServer ¶
type NativeServer struct {
Handler http.Handler
TLSConfig *tls.Config
QUICConfig *xquic.Config
// contains filtered or unexported fields
}
NativeServer is an RFC 9114 server running on the Go+ owned RFC 9000 engine. It is independent of quic-go's server so the Go+ HTTP/3 data path can be deployed and measured without the reference implementation.
func (*NativeServer) Close ¶
func (s *NativeServer) Close() error
Close aborts active connections and stops accepting new ones.
func (*NativeServer) Serve ¶
func (s *NativeServer) Serve(packetConn net.PacketConn) error
Serve serves HTTP/3 on packetConn and owns the packet connection.
type QUICBackend ¶
type QUICBackend uint8
QUICBackend selects the RFC 9000 engine used below HTTP/3.
const ( QUICGo QUICBackend = iota // NativeQUIC selects the Go+ owned RFC 9000 engine. NativeQUIC // XNetQUIC is retained as a compatibility spelling for NativeQUIC. // Deprecated: use NativeQUIC. XNetQUIC = NativeQUIC )
type QUICGoServer ¶
type QUICGoServer struct {
Handler http.Handler
TLSConfig *tls.Config
QUICConfig *quic.Config
// contains filtered or unexported fields
}
QUICGoServer runs Go+'s native RFC 9114 server over quic-go's RFC 9000 transport. This is useful when applications want quic-go's mature packet engine without using its HTTP/3 implementation.
func (*QUICGoServer) Close ¶
func (s *QUICGoServer) Close() error
func (*QUICGoServer) Serve ¶
func (s *QUICGoServer) Serve(packetConn net.PacketConn) error
Serve serves HTTP/3 on packetConn and owns the packet connection.
type RFC9000Config ¶
RFC9000Config configures the Go+ owned RFC 9000 transport engine.
type Transport ¶
type Transport struct {
Backend QUICBackend
TLSClientConfig *tls.Config
QUICConfig *quic.Config
NativeQUICConfig *RFC9000Config
// XQUICConfig is retained for compatibility. NativeQUICConfig takes
// precedence when both are set.
// Deprecated: use NativeQUICConfig.
XQUICConfig *RFC9000Config
Dial func(context.Context, string, *tls.Config, *quic.Config) (*quic.Conn, error)
// MaxConnectionsPerOrigin bounds adaptive connection sharding. Zero uses
// one connection. Sequential traffic continues to use one connection;
// additional connections are created only while all existing connections
// have active requests.
MaxConnectionsPerOrigin int
// contains filtered or unexported fields
}
Transport is a native Go+ HTTP/3 client transport. It uses QUIC v1 for transport and the package's stateless QPACK encoder for request fields.
type XNetServer ¶
type XNetServer = NativeServer
XNetServer is retained as a compatibility spelling for NativeServer. Deprecated: use NativeServer.