From 6781371fc268529f9a12b730ca3939b8ec6bbcfd Mon Sep 17 00:00:00 2001 From: Roman Proskuryakov Date: Thu, 19 Aug 2021 15:19:43 +0300 Subject: [PATCH 1/3] Mv quinn/src/platform/ -> quinn-udp --- Cargo.toml | 4 +-- quinn-udp/Cargo.toml | 29 +++++++++++++++++++ {quinn/src/platform => quinn-udp/src}/cmsg.rs | 0 .../platform => quinn-udp/src}/fallback.rs | 0 .../platform/mod.rs => quinn-udp/src/lib.rs | 0 {quinn/src/platform => quinn-udp/src}/unix.rs | 0 quinn/Cargo.toml | 9 ++---- quinn/src/builders.rs | 6 ++-- quinn/src/connection.rs | 2 +- quinn/src/endpoint.rs | 2 +- quinn/src/lib.rs | 1 - 11 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 quinn-udp/Cargo.toml rename {quinn/src/platform => quinn-udp/src}/cmsg.rs (100%) rename {quinn/src/platform => quinn-udp/src}/fallback.rs (100%) rename quinn/src/platform/mod.rs => quinn-udp/src/lib.rs (100%) rename {quinn/src/platform => quinn-udp/src}/unix.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 5eed32b54..183541e35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] -members = ["quinn", "quinn-proto", "interop", "bench", "perf", "fuzz"] -default-members = ["quinn", "quinn-proto", "interop", "bench", "perf"] +members = ["quinn", "quinn-proto", "quinn-udp", "interop", "bench", "perf", "fuzz"] +default-members = ["quinn", "quinn-proto", "quinn-udp", "interop", "bench", "perf"] [profile.bench] debug = true diff --git a/quinn-udp/Cargo.toml b/quinn-udp/Cargo.toml new file mode 100644 index 000000000..5d5cb6443 --- /dev/null +++ b/quinn-udp/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "quinn-udp" +version = "0.7.0" +authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] +license = "MIT OR Apache-2.0" +repository = "https://github.com/djc/quinn" +description = "UDP sockets with ECN information for the QUIC transport protocol" +keywords = ["quic"] +categories = [ "network-programming", "asynchronous" ] +workspace = ".." +edition = "2018" + +[package.metadata.docs.rs] +all-features = true + +[badges] +maintenance = { status = "experimental" } + +[dependencies] +futures-util = { version = "0.3.11", features = ["io"] } +libc = "0.2.69" +mio = { version = "0.7.7", features = ["net"] } +proto = { package = "quinn-proto", path = "../quinn-proto", version = "0.7" } +socket2 = "0.4" +tracing = "0.1.10" +tokio = { version = "1.0.1", features = ["net"] } + +[target.'cfg(unix)'.dependencies] +lazy_static = "1" diff --git a/quinn/src/platform/cmsg.rs b/quinn-udp/src/cmsg.rs similarity index 100% rename from quinn/src/platform/cmsg.rs rename to quinn-udp/src/cmsg.rs diff --git a/quinn/src/platform/fallback.rs b/quinn-udp/src/fallback.rs similarity index 100% rename from quinn/src/platform/fallback.rs rename to quinn-udp/src/fallback.rs diff --git a/quinn/src/platform/mod.rs b/quinn-udp/src/lib.rs similarity index 100% rename from quinn/src/platform/mod.rs rename to quinn-udp/src/lib.rs diff --git a/quinn/src/platform/unix.rs b/quinn-udp/src/unix.rs similarity index 100% rename from quinn/src/platform/unix.rs rename to quinn-udp/src/unix.rs diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 9e6cf0c01..98047cb7a 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -33,20 +33,15 @@ bytes = "1" futures-util = { version = "0.3.11", default-features = false, features = ["io"] } futures-channel = "0.3.11" fxhash = "0.2.1" -libc = "0.2.69" -mio = { version = "0.7.7", features = ["net"] } once_cell = "1.7.2" proto = { package = "quinn-proto", path = "../quinn-proto", version = "0.7", default-features = false } rustls = { version = "0.19", features = ["quic"], optional = true } -socket2 = "0.4" thiserror = "1.0.21" tracing = "0.1.10" -tokio = { version = "1.0.1", features = ["net", "rt", "time"] } +tokio = { version = "1.0.1", features = ["rt", "time"] } +udp = { package = "quinn-udp", path = "../quinn-udp", version = "0.7" } webpki = { version = "0.21", default-features = false, optional = true } -[target.'cfg(unix)'.dependencies] -lazy_static = "1" - [dev-dependencies] anyhow = "1.0.22" crc = "1.8.1" diff --git a/quinn/src/builders.rs b/quinn/src/builders.rs index 1b6251756..393532bab 100644 --- a/quinn/src/builders.rs +++ b/quinn/src/builders.rs @@ -7,11 +7,9 @@ use proto::{ }; use thiserror::Error; use tracing::error; +use udp::UdpSocket; -use crate::{ - endpoint::{Endpoint, EndpointDriver, EndpointRef, Incoming}, - platform::UdpSocket, -}; +use crate::endpoint::{Endpoint, EndpointDriver, EndpointRef, Incoming}; #[cfg(feature = "rustls")] use crate::{Certificate, CertificateChain, PrivateKey}; diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 9ceeea496..8b1825e94 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -17,11 +17,11 @@ use proto::{ConnectionError, ConnectionHandle, ConnectionStats, Dir, StreamEvent use thiserror::Error; use tokio::time::{sleep_until, Instant as TokioInstant, Sleep}; use tracing::info_span; +use udp::caps; use crate::{ broadcast::{self, Broadcast}, mutex::Mutex, - platform::caps, recv_stream::RecvStream, send_stream::{SendStream, WriteError}, ConnectionEvent, EndpointEvent, VarInt, diff --git a/quinn/src/endpoint.rs b/quinn/src/endpoint.rs index 316916cc1..a2fa912ff 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -22,12 +22,12 @@ use proto::{ generic::{ClientConfig, ServerConfig}, ConnectError, ConnectionHandle, DatagramEvent, }; +use udp::{RecvMeta, UdpSocket, BATCH_SIZE}; use crate::{ broadcast::{self, Broadcast}, builders::EndpointBuilder, connection::Connecting, - platform::{RecvMeta, UdpSocket, BATCH_SIZE}, work_limiter::WorkLimiter, ConnectionEvent, EndpointEvent, VarInt, IO_LOOP_BOUND, RECV_TIME_BOUND, SEND_TIME_BOUND, }; diff --git a/quinn/src/lib.rs b/quinn/src/lib.rs index e75d1725a..ddcda473a 100644 --- a/quinn/src/lib.rs +++ b/quinn/src/lib.rs @@ -57,7 +57,6 @@ mod builders; mod connection; mod endpoint; mod mutex; -mod platform; mod recv_stream; mod send_stream; mod work_limiter; From b509e39de5c6bc3675e977ef3ec06b655efc531a Mon Sep 17 00:00:00 2001 From: Roman Proskuryakov Date: Thu, 19 Aug 2021 16:39:27 +0300 Subject: [PATCH 2/3] Fix repo urls for quinn* crates --- quinn-proto/Cargo.toml | 2 +- quinn-udp/Cargo.toml | 2 +- quinn/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quinn-proto/Cargo.toml b/quinn-proto/Cargo.toml index 80a3402fa..2bbe1d89f 100644 --- a/quinn-proto/Cargo.toml +++ b/quinn-proto/Cargo.toml @@ -3,7 +3,7 @@ name = "quinn-proto" version = "0.7.0" authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] license = "MIT OR Apache-2.0" -repository = "https://github.com/djc/quinn" +repository = "https://github.com/quinn-rs/quinn" description = "State machine for the QUIC transport protocol" keywords = ["quic"] categories = [ "network-programming", "asynchronous" ] diff --git a/quinn-udp/Cargo.toml b/quinn-udp/Cargo.toml index 5d5cb6443..1f4ac3ea2 100644 --- a/quinn-udp/Cargo.toml +++ b/quinn-udp/Cargo.toml @@ -3,7 +3,7 @@ name = "quinn-udp" version = "0.7.0" authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] license = "MIT OR Apache-2.0" -repository = "https://github.com/djc/quinn" +repository = "https://github.com/quinn-rs/quinn" description = "UDP sockets with ECN information for the QUIC transport protocol" keywords = ["quic"] categories = [ "network-programming", "asynchronous" ] diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 98047cb7a..943c7cbe0 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -3,7 +3,7 @@ name = "quinn" version = "0.7.0" authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] license = "MIT OR Apache-2.0" -repository = "https://github.com/djc/quinn" +repository = "https://github.com/quinn-rs/quinn" description = "QUIC transport protocol implementation for Tokio" readme = "../README.md" keywords = ["quic"] From c93533e7568178b33d8f8e3e04ec4f83b7cf1435 Mon Sep 17 00:00:00 2001 From: Roman Proskuryakov Date: Thu, 19 Aug 2021 16:49:45 +0300 Subject: [PATCH 3/3] Add quinn-udp to the list of crates into the main README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0fa8f187b..618db2e4b 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ This library is at [draft 32][current-draft]. - **quinn:** High-level async API based on tokio, see for usage. This will be used by most developers. (Basic benchmarks are included.) - **quinn-proto:** Deterministic state machine of the protocol which performs [**no** I/O][sans-io] internally and is suitable for use with custom event loops (and potentially a C or C++ API). +- **quinn-udp:** UDP sockets with ECN information tuned for the protocol. - **quinn-h3:** Contains an implementation of HTTP-3 and QPACK. It is split internally in a deterministic state machine and a tokio-based high-level async API. - **bench:** Benchmarks without any framework. - **interop:** Tooling that helps to run interoperability tests.