quicfault

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package quicfault provides a deterministic, connection-aware HTTP/3 origin for transport recovery tests. It is deliberately test-oriented: callers can reject one request stream, hold an older-generation request until a newer connection is usable, and inspect which server-side QUIC connections remain alive after client drain.

Index

Constants

View Source
const (
	ConnectionHeader = "X-H3fuzz-Fault-Connection"

	PathOK          = "/ok"
	PathRejectOnce  = "/reject-once"
	PathRejectTwice = "/reject-twice"
	PathHoldReject  = "/hold-reject"
	PathStreamReset = "/stream-reset"
	PathWait        = "/wait"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Origin

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

Origin owns a real UDP listener and HTTP/3 server. Its controls are safe for concurrent use and intentionally expose only deterministic fault operations.

func Start

func Start() (*Origin, error)

Start starts a loopback HTTP/3 origin with a generated test certificate.

func (*Origin) ClientTLSConfig

func (o *Origin) ClientTLSConfig() *tls.Config

ClientTLSConfig returns a test-only client configuration for the generated certificate.

func (*Origin) Close

func (o *Origin) Close(ctx context.Context) error

Close stops accepting and closes every server-side connection. It is safe to call repeatedly.

func (*Origin) CloseConnection

func (o *Origin) CloseConnection(id uint64, code quic.ApplicationErrorCode) error

CloseConnection terminates one named server-side connection.

func (*Origin) ConnectionAlive

func (o *Origin) ConnectionAlive(id uint64) bool

ConnectionAlive reports whether the named server-side QUIC connection is still open.

func (*Origin) ConnectionCount

func (o *Origin) ConnectionCount() uint64

ConnectionCount returns how many QUIC connections reached ConnContext.

func (*Origin) ReleaseHeld

func (o *Origin) ReleaseHeld()

ReleaseHeld makes the blocked old-generation request fail with H3_REQUEST_REJECTED. Its transparent retry will succeed on a newer connection.

func (*Origin) ServeHTTP

func (o *Origin) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Origin) URL

func (o *Origin) URL(path string) string

URL returns an https URL rooted at the fault origin.

func (*Origin) WaitBlocked

func (o *Origin) WaitBlocked(ctx context.Context) (uint64, error)

WaitBlocked waits until a PathWait handler is waiting for caller cancellation or deadline expiry.

func (*Origin) WaitHeld

func (o *Origin) WaitHeld(ctx context.Context) (uint64, error)

WaitHeld waits until PathHoldReject is blocked on its original connection.

Jump to

Keyboard shortcuts

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