- Notifications
You must be signed in to change notification settings - Fork140
An implementation of the IETF QUIC protocol
License
aws/s2n-quic
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
s2n-quic
is a Rust implementation of theIETF QUIC protocol, featuring:
- a simple, easy-to-use API. Seean example of an s2n-quic echo server built with just a few API calls
- high configurability usingproviders for granular control of functionality
- extensive automated testing, including fuzz testing, integration testing, unit testing, snapshot testing, efficiency testing, performance benchmarking, interoperability testing andmore
- integration withs2n-tls, AWS's simple, small, fast and secure TLS implementation, as well asrustls
- thoroughcompliance coverage tracking of normative language in relevant standards
- and much more, includingCUBIC congestion controller support,packet pacing,Generic Segmentation Offload support,Path MTU discovery, and uniqueconnection identifiers detached from the address
See theAPI documentation,examples, ands2n-quic Guide to get started withs2n-quic
.
s2n-quic
is available oncrates.io
and can be added to a project like so:
[dependencies]s2n-quic ="1"
NOTE: On unix-like systems,s2n-tls
will be used as the default TLS provider.On linux systems,aws-lc-rs
will be used for cryptographicoperations. A C compiler and CMake may be required on these systems for installation.
The following implements a basic echo server and client. The client connects to the server and pipes itsstdin
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 tostdout
.
// src/bin/server.rsuse s2n_quic::Server;use std::{error::Error, path::Path};#[tokio::main]asyncfnmain() ->Result<(),Box<dynError>>{letmut server =Server::builder().with_tls((Path::new("cert.pem"),Path::new("key.pem")))?.with_io("127.0.0.1:4433")?.start()?;whileletSome(mut connection) = server.accept().await{// spawn a new task for the connection tokio::spawn(asyncmove{whileletOk(Some(mut stream)) = connection.accept_bidirectional_stream().await{// spawn a new task for the stream tokio::spawn(asyncmove{// echo any data back to the streamwhileletOk(Some(data)) = stream.receive().await{ stream.send(data).await.expect("stream should be open");}});}});}Ok(())}
// src/bin/client.rsuse s2n_quic::{client::Connect,Client};use std::{error::Error, path::Path, net::SocketAddr};#[tokio::main]asyncfnmain() ->Result<(),Box<dynError>>{let client =Client::builder().with_tls(Path::new("cert.pem"))?.with_io("0.0.0.0:0")?.start()?;let addr:SocketAddr ="127.0.0.1:4433".parse()?;let connect =Connect::new(addr).with_server_name("localhost");letmut connection = client.connect(connect).await?;// ensure the connection doesn't time out with inactivity connection.keep_alive(true)?;// open a new stream and split the receiving and sending sideslet 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(asyncmove{letmut stdout = tokio::io::stdout();let _ = tokio::io::copy(&mut receive_stream,&mut stdout).await;});// copy data from stdin and send it to the serverletmut stdin = tokio::io::stdin(); tokio::io::copy(&mut stdin,&mut send_stream).await?;Ok(())}
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 is1.82.0.
s2n-quic
can be built on Linux, MacOS, and Windows.s2n-quic
requires Linux kernel version 5.0 or later. Earlier Linux kernel versions are not supported as they lack the Generic Segmentation Offload (GSO) capabilities required bys2n-quic
.
If you discover a potential security issue in s2n-quic we ask that you notifyAWS Security via ourvulnerability reporting page. Please donot 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 contacts2n-pre-notification@amazon.com.
This project is licensed under theApache-2.0 License.
About
An implementation of the IETF QUIC protocol
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.