Class Http3Options

java.lang.Object
org.microproxy.Http3Options

public final class Http3Options extends Object
Limits and timers for HTTP/3 (HttpProxyServerBootstrap.withHttp3(boolean) and HttpProxyServerBootstrap.withHttp3Upstream(boolean)). Every value has a default meant for browsers and API clients; a client that goes past a limit gets its stream reset, or the connection closed with an HTTP/3 error code. Where HTTP/2 counts frames to defend itself, HTTP/3 leaves much of the work to QUIC: the stream limit and flow control are QUIC's, enforced by the transport.

The rate limits count events within one window (10 seconds by default); the count starts again with each window.


 MicroProxy.bootstrap()
         .withReverseProxy("https://backend.internal")
         .withSslContextSource(new KeyStoreSslContextSource(Path.of("site.p12"), password))
         .withHttp3(true)
         .withHttp3Options(Http3Options.builder().maxConcurrentStreams(250).build())
         .start();
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Builds Http3Options.
    static enum 
    The congestion controllers of the proxy's QUIC connections (see Http3Options.Builder.quicCongestionControl).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Http3Options
    The defaults: see each Http3Options.Builder method.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether a reverse proxy serving HTTP/3 advertises it with Alt-Svc on its TCP responses.
    Returns the max-age (ma) of the proxy's own Alt-Svc advertisement.
    Starts a builder with the default settings.
    long
    Returns the flow-control window of a connection, for all its streams together.
    Returns how long a CONNECT-UDP flow lives without a datagram in either direction.
    boolean
    Returns whether QUIC inside CONNECT-UDP flows is decided on as transparent QUIC is, rather than relayed.
    int
    Returns the CONNECT-UDP flows the proxy relays at once.
    int
    Returns the CONNECT-UDP flows one client connection may have open at once.
    int
    Returns the datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them.
    long
    Returns the bytes of datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them.
    Returns the target ports of the CONNECT-UDP flows whose QUIC is decided on; empty for every port.
    Returns how long a CONNECT-UDP request that finds the proxy's bound on flows full waits for flows already ending to give their places back.
    Returns the URI template CONNECT-UDP requests name their target with (RFC 9298).
    int
    Returns the request streams a client may have open at once (QUIC's bidirectional stream limit).
    long
    SETTINGS_MAX_FIELD_SECTION_SIZE, or 0 for the default: the proxy's max_header_size plus max_initial_line_length, the same room an HTTP/1 request head has.
    int
    Returns requests a client may cancel before their response completes, per window.
    int
    Returns frames of unknown and reserved types, and empty DATA frames, a peer may send per window.
    int
    Returns unidirectional streams of unknown and reserved types a peer may open per window.
    Returns the directory the proxy's QUIC connections write qlog files to, or null for none.
    long
    Returns the largest a qlog file grows; past it, the connection's later events are left out.
    int
    Returns how many qlog files the directory keeps; past it, the oldest are deleted.
    int
    Returns SETTINGS_QPACK_BLOCKED_STREAMS: streams that may wait for the peer's QPACK encoder stream at once.
    long
    Returns SETTINGS_QPACK_MAX_TABLE_CAPACITY: the QPACK dynamic table each side may use, in bytes.
    Returns the congestion controller of the proxy's QUIC connections, to clients and to servers.
    Returns the window the rate limits count events in.
    boolean
    Returns whether the HTTP/3 listeners validate client addresses with a QUIC Retry first.
    long
    Returns the flow-control window of each stream: the most a peer may send ahead of the proxy's reading.
    Starts a builder initialized with these settings.
     
    long
    Returns the bytes of datagrams the transparent QUIC listener holds for new clients, all together.
    int
    Returns the new clients the transparent QUIC listener holds at once while it reads their ClientHellos.
    int
    Returns the new clients from one IP address that the transparent QUIC listener holds at once.
    int
    Returns the QUIC flows the transparent QUIC listener relays at once, each with a socket of its own.
    int
    Returns the relayed QUIC flows of one IP address at once.
    Returns how long the transparent QUIC listener waits for a new client's complete ClientHello, and its decision.
    Returns how long a relayed QUIC flow of the transparent QUIC listener lives without a datagram either way.
    Returns how long a server whose QUIC handshake failed is reached over TCP only.
    Returns how long a QUIC handshake with a server may take before its request goes over TCP instead.
    boolean
    Whether requests that are safe to replay go to HTTP/3 servers as 0-RTT early data when the proxy resumes a session with them: on by default.
    boolean
    Whether the HTTP/3 listeners accept 0-RTT early data from clients that resume a session: off by default.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • builder

      public static Http3Options.Builder builder()
      Starts a builder with the default settings.
      Returns:
      a new builder with default settings
    • toBuilder

      public Http3Options.Builder toBuilder()
      Starts a builder initialized with these settings.
      Returns:
      a new builder initialized with these settings
    • maxConcurrentStreams

      public int maxConcurrentStreams()
      Returns the request streams a client may have open at once (QUIC's bidirectional stream limit).
      Returns:
      the request streams a client may have open at once (QUIC's bidirectional stream limit)
    • streamReceiveWindow

      public long streamReceiveWindow()
      Returns the flow-control window of each stream: the most a peer may send ahead of the proxy's reading.
      Returns:
      the flow-control window of each stream: the most a peer may send ahead of the proxy's reading
    • connectionReceiveWindow

      public long connectionReceiveWindow()
      Returns the flow-control window of a connection, for all its streams together.
      Returns:
      the flow-control window of a connection, for all its streams together
    • maxFieldSectionSize

      public long maxFieldSectionSize()
      SETTINGS_MAX_FIELD_SECTION_SIZE, or 0 for the default: the proxy's max_header_size plus max_initial_line_length, the same room an HTTP/1 request head has.
      Returns:
      the largest field section accepted, or zero to derive it from the HTTP/1 limits
    • qpackMaxTableCapacity

      public long qpackMaxTableCapacity()
      Returns SETTINGS_QPACK_MAX_TABLE_CAPACITY: the QPACK dynamic table each side may use, in bytes.
      Returns:
      SETTINGS_QPACK_MAX_TABLE_CAPACITY: the QPACK dynamic table each side may use, in bytes
    • qpackBlockedStreams

      public int qpackBlockedStreams()
      Returns SETTINGS_QPACK_BLOCKED_STREAMS: streams that may wait for the peer's QPACK encoder stream at once.
      Returns:
      SETTINGS_QPACK_BLOCKED_STREAMS: streams that may wait for the peer's QPACK encoder stream at once
    • rateWindow

      public Duration rateWindow()
      Returns the window the rate limits count events in.
      Returns:
      the window the rate limits count events in
    • maxUnknownFrames

      public int maxUnknownFrames()
      Returns frames of unknown and reserved types, and empty DATA frames, a peer may send per window.
      Returns:
      frames of unknown and reserved types, and empty DATA frames, a peer may send per window
    • maxUnknownStreams

      public int maxUnknownStreams()
      Returns unidirectional streams of unknown and reserved types a peer may open per window.
      Returns:
      unidirectional streams of unknown and reserved types a peer may open per window
    • maxRapidResets

      public int maxRapidResets()
      Returns requests a client may cancel before their response completes, per window.
      Returns:
      requests a client may cancel before their response completes, per window
    • retry

      public boolean retry()
      Returns whether the HTTP/3 listeners validate client addresses with a QUIC Retry first.
      Returns:
      whether the HTTP/3 listeners validate client addresses with a QUIC Retry first
    • zeroRtt

      public boolean zeroRtt()
      Whether the HTTP/3 listeners accept 0-RTT early data from clients that resume a session: off by default. See Http3Options.Builder.zeroRtt(boolean).
      Returns:
      whether 0-RTT is accepted
    • upstreamZeroRtt

      public boolean upstreamZeroRtt()
      Whether requests that are safe to replay go to HTTP/3 servers as 0-RTT early data when the proxy resumes a session with them: on by default. See Http3Options.Builder.upstreamZeroRtt(boolean).
      Returns:
      whether the proxy sends 0-RTT data to servers
    • upstreamHandshakeTimeout

      public Duration upstreamHandshakeTimeout()
      Returns how long a QUIC handshake with a server may take before its request goes over TCP instead.
      Returns:
      how long a QUIC handshake with a server may take before its request goes over TCP instead
    • upstreamFailureTimeout

      public Duration upstreamFailureTimeout()
      Returns how long a server whose QUIC handshake failed is reached over TCP only.
      Returns:
      how long a server whose QUIC handshake failed is reached over TCP only
    • altSvc

      public boolean altSvc()
      Returns whether a reverse proxy serving HTTP/3 advertises it with Alt-Svc on its TCP responses.
      Returns:
      whether a reverse proxy serving HTTP/3 advertises it with Alt-Svc on its TCP responses
    • altSvcMaxAge

      public Duration altSvcMaxAge()
      Returns the max-age (ma) of the proxy's own Alt-Svc advertisement.
      Returns:
      the max-age (ma) of the proxy's own Alt-Svc advertisement
    • transparentRelayIdleTimeout

      public Duration transparentRelayIdleTimeout()
      Returns how long a relayed QUIC flow of the transparent QUIC listener lives without a datagram either way.
      Returns:
      how long a relayed QUIC flow of the transparent QUIC listener lives without a datagram either way
    • transparentPendingTimeout

      public Duration transparentPendingTimeout()
      Returns how long the transparent QUIC listener waits for a new client's complete ClientHello, and its decision.
      Returns:
      how long the transparent QUIC listener waits for a new client's complete ClientHello, and its decision
    • transparentMaxPending

      public int transparentMaxPending()
      Returns the new clients the transparent QUIC listener holds at once while it reads their ClientHellos.
      Returns:
      the new clients the transparent QUIC listener holds at once while it reads their ClientHellos
    • transparentMaxPendingPerSource

      public int transparentMaxPendingPerSource()
      Returns the new clients from one IP address that the transparent QUIC listener holds at once.
      Returns:
      the new clients from one IP address that the transparent QUIC listener holds at once
    • transparentMaxRelayFlows

      public int transparentMaxRelayFlows()
      Returns the QUIC flows the transparent QUIC listener relays at once, each with a socket of its own.
      Returns:
      the QUIC flows the transparent QUIC listener relays at once, each with a socket of its own
    • transparentMaxRelayFlowsPerSource

      public int transparentMaxRelayFlowsPerSource()
      Returns the relayed QUIC flows of one IP address at once.
      Returns:
      the relayed QUIC flows of one IP address at once
    • transparentMaxBufferedBytes

      public long transparentMaxBufferedBytes()
      Returns the bytes of datagrams the transparent QUIC listener holds for new clients, all together.
      Returns:
      the bytes of datagrams the transparent QUIC listener holds for new clients, all together
    • connectUdpTemplate

      public String connectUdpTemplate()
      Returns the URI template CONNECT-UDP requests name their target with (RFC 9298).
      Returns:
      the URI template CONNECT-UDP requests name their target with (RFC 9298)
    • connectUdpIdleTimeout

      public Duration connectUdpIdleTimeout()
      Returns how long a CONNECT-UDP flow lives without a datagram in either direction.
      Returns:
      how long a CONNECT-UDP flow lives without a datagram in either direction
    • connectUdpMaxFlows

      public int connectUdpMaxFlows()
      Returns the CONNECT-UDP flows the proxy relays at once.
      Returns:
      the CONNECT-UDP flows the proxy relays at once
    • connectUdpMaxFlowsPerConnection

      public int connectUdpMaxFlowsPerConnection()
      Returns the CONNECT-UDP flows one client connection may have open at once.
      Returns:
      the CONNECT-UDP flows one client connection may have open at once
    • connectUdpReleaseWait

      public Duration connectUdpReleaseWait()
      Returns how long a CONNECT-UDP request that finds the proxy's bound on flows full waits for flows already ending to give their places back.
      Returns:
      how long a CONNECT-UDP request that finds the proxy's bound on flows full waits for flows already ending to give their places back
    • connectUdpMaxQueued

      public int connectUdpMaxQueued()
      Returns the datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them.
      Returns:
      the datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them
    • connectUdpMaxQueuedBytes

      public long connectUdpMaxQueuedBytes()
      Returns the bytes of datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them.
      Returns:
      the bytes of datagrams a CONNECT-UDP flow queues in each direction, beyond which it drops them
    • connectUdpInterceptQuic

      public boolean connectUdpInterceptQuic()
      Returns whether QUIC inside CONNECT-UDP flows is decided on as transparent QUIC is, rather than relayed.
      Returns:
      whether QUIC inside CONNECT-UDP flows is decided on as transparent QUIC is, rather than relayed
    • connectUdpQuicPorts

      public Set<Integer> connectUdpQuicPorts()
      Returns the target ports of the CONNECT-UDP flows whose QUIC is decided on; empty for every port.
      Returns:
      the target ports of the CONNECT-UDP flows whose QUIC is decided on; empty for every port
    • quicCongestionControl

      public Http3Options.QuicCongestionControl quicCongestionControl()
      Returns the congestion controller of the proxy's QUIC connections, to clients and to servers.
      Returns:
      the congestion controller of the proxy's QUIC connections, to clients and to servers
    • qlogDirectory

      public Path qlogDirectory()
      Returns the directory the proxy's QUIC connections write qlog files to, or null for none.
      Returns:
      the directory the proxy's QUIC connections write qlog files to, or null for none
    • qlogMaxFiles

      public int qlogMaxFiles()
      Returns how many qlog files the directory keeps; past it, the oldest are deleted.
      Returns:
      how many qlog files the directory keeps; past it, the oldest are deleted
    • qlogMaxFileBytes

      public long qlogMaxFileBytes()
      Returns the largest a qlog file grows; past it, the connection's later events are left out.
      Returns:
      the largest a qlog file grows; past it, the connection's later events are left out
    • toString

      public String toString()
      Overrides:
      toString in class Object