TQUIC

repository·develop·Indexed 23 days ago

https://github.com/tencent/tquic

A high-performance, lightweight, and cross-platform implementation of the IETF QUIC and HTTP/3 protocols. Written in Rust for memory safety, TQUIC provides C/C++ interoperability and features pluggable congestion control (CUBIC, BBR, BBRv3, COPA), Multipath QUIC, and a suite of tools including tquic_client and tquic_server. Version 1.6.0.

Tokens
13.7K
Snippets
22
Records
76
Agent score
80%

What's inside tquic

  1. Overview of TQUIC features and advantages

    develop

    TQUIC is a high-performance, lightweight, and cross-platform implementation of the IETF QUIC protocol. Key features include:

    • High Performance: Designed for low latency. Refer to the official benchmark results for details.
    • Pluggable Congestion Control: Supports multiple algorithms including CUBIC, BBR, BBRv3, and COPA.
    • Multi-path Transmission: Supports using multiple paths simultaneously for a single connection to improve performance and reliability.
    • Cross-language Support: While written in Rust for memory safety, it provides interfaces for Rust, C, and C++.
    • Protocol Compliance: Verified via Ivy formal specification and has passed IETF interoperability tests.
    • Feature Rich: Supports all major features defined in the QUIC and HTTP/3 specifications.
  2. Overview of TQUIC

    develop

    TQUIC is a high-performance, lightweight, and cross-platform implementation of the IETF QUIC protocol. It is written in Rust to ensure memory safety and is designed for low latency and high performance.

    Key features include:

    • Pluggable Congestion Control: Supports algorithms like CUBIC, BBR, BBRv3, and COPA.
    • Multipath QUIC: Enables simultaneous usage of multiple paths for a single connection.
    • Cross-platform APIs: Provides interfaces for Rust, C, and C++.
    • Protocol Compliance: Verified by formal specification (Ivy tool) and passed IETF interoperability tests.
    • Rich Feature Set: Supports major features conforming to QUIC and HTTP/3 RFCs.
  3. Overview of TQUIC tools

    develop

    The tquic_tools package provides two primary utilities for working with the QUIC and HTTP/3 protocols:

    • tquic_client: A client implementation for QUIC and HTTP/3. It can also be used as an HTTP/3 benchmarking tool.
    • tquic_server: A server implementation for QUIC and HTTP/3 designed to serve static files.
  4. Get started with TQUIC installation and testing

    develop
    To build, run, and test TQUIC, refer to the official installation guide. The guide covers the necessary steps for building the library and executing the test suite to ensure a correct setup.
  5. Run TQUIC interop test cases

    develop

    The interop runner uses a Python script run.py to execute test cases between different QUIC implementations. To run an http3 test case comparing TQUIC against itself using the built Docker image, use the following command:

    Arguments:

    • -s tquic: The server implementation to use.
    • -c tquic: The client implementation to use.
    • -t http3: The specific test type (HTTP/3).
    • -d: Enables debug mode.
    • -r tquic=tquic_interop:v1: Maps the tquic implementation to the specific Docker image tag built previously.
    # Run test case http3
    python3 run.py -s tquic -c tquic -t http3 -d -r tquic=tquic_interop:v1
  6. Build the TQUIC interop docker image

    develop

    To build the Docker image required for running the TQUIC interop runner, execute the build command from the repository root. This image is used to provide the TQUIC environment for testing.

    docker build -t tquic_interop:v1 -f interop/Dockerfile .
  7. Manage QUIC transport parameters with TransportParams

    develop

    The TransportParams struct represents the sequence of transport parameters carried in a TLS extension for integrity protection, as defined in RFC 9000 Section 18. It allows configuring connection-level settings such as idle timeouts, flow control limits, and stream limits.

    Key parameters include:

    • max_idle_timeout: Maximum idle time in milliseconds.
    • max_udp_payload_size: Limits the size of UDP payloads (minimum 1200).
    • initial_max_data: Initial connection-level flow control limit.
    • initial_max_streams_bidi / initial_max_streams_uni: Limits on the number of bidirectional and unidirectional streams.
    • ack_delay_exponent: Exponent used to decode ACK Delay.
    • max_ack_delay: Maximum delay for sending acknowledgments.
    • active_conn_id_limit: Maximum number of connection IDs from the peer to store (must be at least 2).

    Note that certain parameters are role-specific:

    • original_destination_connection_id and retry_source_connection_id are only sent by a server.
    • preferred_address is only sent by a server.
    let tp = TransportParams {
        max_idle_timeout: 60,
        max_udp_payload_size: 1300,
        initial_max_data: 4 * 1024 * 1024,
        initial_max_streams_bidi: 200,
        // ... other fields
        ..Default::default()
    };
  8. Use DeliveryRateEstimator to estimate data delivery rates

    develop

    The DeliveryRateEstimator implements a generic algorithm for a transport protocol sender to estimate the current delivery rate of its data on the fly, following the IETF draft cheng-iccrg-delivery-rate-estimation-02.

    To use it, you must follow a specific lifecycle of events:

    1. On Packet Sent: Call on_packet_sent every time a packet is transmitted to initialize or update the estimator's state.
    2. On Packet Acked: Call update_rate_sample when a packet is SACKed or ACKed to update the internal counters.
    3. Generate Sample: Call generate_rate_sample (typically upon receiving an ACK) to compute the final delivery rate based on the accumulated data and time intervals.

    Note that the estimator handles "application-limited" states, which occur when the sender is not sending data continuously due to application constraints rather than network congestion.

  9. Map PacketType to Encryption Level and SpaceId

    develop

    The PacketType enum determines the QUIC encryption level and the packet space (e.g., Initial, Handshake, or Data) used for processing.

    PacketTypeLevelSpaceId
    InitialLevel::InitialSpaceId::Initial
    HandshakeLevel::HandshakeSpaceId::Handshake
    ZeroRTTLevel::ZeroRTTSpaceId::Data
    OneRTTLevel::OneRTTSpaceId::Data
    VersionNegotiationErrorError
    RetryErrorError