#s2n #quic


A Rust implementation of the IETF QUIC protocol

23 stable releases

new 1.17.1 Mar 22, 2023
1.15.0 Jan 10, 2023
1.14.0 Dec 13, 2022
1.13.0 Nov 28, 2022
0.0.0 Feb 16, 2022

#60 in Network programming

Download history 52/week @ 2022-12-06 81/week @ 2022-12-13 84/week @ 2022-12-20 29/week @ 2022-12-27 64/week @ 2023-01-03 197/week @ 2023-01-10 355/week @ 2023-01-17 875/week @ 2023-01-24 1018/week @ 2023-01-31 95/week @ 2023-02-07 124/week @ 2023-02-14 142/week @ 2023-02-21 256/week @ 2023-02-28 159/week @ 2023-03-07 166/week @ 2023-03-14 203/week @ 2023-03-21

830 downloads per month
Used in 2 crates (via lunatic-distributed)


88K SLoC


s2n-quic is a Rust implementation of the IETF QUIC protocol, featuring:

See the API documentation and examples to get started with s2n-quic.

Crates.io docs.rs Apache 2.0 Licensed Build Status Dependencies MSRV


s2n-quic is available on crates.io and can be added to a project like so:

s2n-quic = "1"

NOTE: On unix-like systems, s2n-tls will be used as the default TLS provider and requires a C compiler to be installed.


The following implements a basic echo server and client. The client connects to the server and pipes its stdin on a stream. The server listens for new streams and pipes any data it receives back to the client. The client will then pipe all stream data to stdout.


// src/bin/server.rs
use s2n_quic::Server;
use std::error::Error;

async fn main() -> Result<(), Box<dyn Error>> {
    let mut server = Server::builder()
        .with_tls(("./path/to/cert.pem", "./path/to/key.pem"))?

    while let Some(mut connection) = server.accept().await {
        // spawn a new task for the connection
        tokio::spawn(async move {
            while let Ok(Some(mut stream)) = connection.accept_bidirectional_stream().await {
                // spawn a new task for the stream
                tokio::spawn(async move {
                    // echo any data back to the stream
                    while let Ok(Some(data)) = stream.receive().await {
                        stream.send(data).await.expect("stream should be open");



// src/bin/client.rs
use s2n_quic::{client::Connect, Client};
use std::{error::Error, net::SocketAddr};

async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::builder()

    let addr: SocketAddr = "".parse()?;
    let connect = Connect::new(addr).with_server_name("localhost");
    let mut connection = client.connect(connect).await?;

    // ensure the connection doesn't time out with inactivity

    // open a new stream and split the receiving and sending sides
    let stream = connection.open_bidirectional_stream().await?;
    let (mut receive_stream, mut send_stream) = stream.split();

    // spawn a task that copies responses from the server to stdout
    tokio::spawn(async move {
        let mut stdout = tokio::io::stdout();
        let _ = tokio::io::copy(&mut receive_stream, &mut stdout).await;

    // copy data from stdin and send it to the server
    let mut stdin = tokio::io::stdin();
    tokio::io::copy(&mut stdin, &mut send_stream).await?;


Minimum Supported Rust Version (MSRV)

s2n-quic will maintain a rolling MSRV (minimum supported rust version) policy of at least 6 months. The current s2n-quic version is not guaranteed to build on Rust versions earlier than the MSRV.

The current MSRV is 1.63.0.

Security issue notifications

If you discover a potential security issue in s2n-quic we ask that you notify AWS Security via our vulnerability reporting page. Please do not create a public github issue.

If you package or distribute s2n-quic, or use s2n-quic as part of a large multi-user service, you may be eligible for pre-notification of future s2n-quic releases. Please contact s2n-pre-notification@amazon.com.


This project is licensed under the Apache-2.0 License.


~272K SLoC