From 3da54b178c138e0d2f7c00bdec33dabaa3f034cc Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 2 Oct 2018 21:57:46 +0200 Subject: [PATCH] Rename crates from quicr{,-core} to quinn{,-proto} --- Cargo.toml | 2 +- README.md | 2 +- {quicr-core => quinn-proto}/Cargo.toml | 2 +- .../examples/connect.rs | 4 +- {quicr-core => quinn-proto}/src/coding.rs | 0 {quicr-core => quinn-proto}/src/connection.rs | 0 {quicr-core => quinn-proto}/src/crypto.rs | 0 {quicr-core => quinn-proto}/src/endpoint.rs | 0 {quicr-core => quinn-proto}/src/frame.rs | 0 {quicr-core => quinn-proto}/src/lib.rs | 0 .../src/memory_stream.rs | 0 {quicr-core => quinn-proto}/src/packet.rs | 0 {quicr-core => quinn-proto}/src/range_set.rs | 0 {quicr-core => quinn-proto}/src/stream.rs | 0 {quicr-core => quinn-proto}/src/tests.rs | 0 .../src/transport_error.rs | 0 .../src/transport_parameters.rs | 0 {quicr-core => quinn-proto}/src/varint.rs | 0 {quicr => quinn}/Cargo.toml | 4 +- {quicr => quinn}/examples/client.rs | 6 +-- {quicr => quinn}/examples/interop.rs | 8 ++-- {quicr => quinn}/examples/server.rs | 18 ++++---- {quicr => quinn}/src/lib.rs | 42 +++++++++---------- 23 files changed, 44 insertions(+), 44 deletions(-) rename {quicr-core => quinn-proto}/Cargo.toml (97%) rename {quicr-core => quinn-proto}/examples/connect.rs (98%) rename {quicr-core => quinn-proto}/src/coding.rs (100%) rename {quicr-core => quinn-proto}/src/connection.rs (100%) rename {quicr-core => quinn-proto}/src/crypto.rs (100%) rename {quicr-core => quinn-proto}/src/endpoint.rs (100%) rename {quicr-core => quinn-proto}/src/frame.rs (100%) rename {quicr-core => quinn-proto}/src/lib.rs (100%) rename {quicr-core => quinn-proto}/src/memory_stream.rs (100%) rename {quicr-core => quinn-proto}/src/packet.rs (100%) rename {quicr-core => quinn-proto}/src/range_set.rs (100%) rename {quicr-core => quinn-proto}/src/stream.rs (100%) rename {quicr-core => quinn-proto}/src/tests.rs (100%) rename {quicr-core => quinn-proto}/src/transport_error.rs (100%) rename {quicr-core => quinn-proto}/src/transport_parameters.rs (100%) rename {quicr-core => quinn-proto}/src/varint.rs (100%) rename {quicr => quinn}/Cargo.toml (92%) rename {quicr => quinn}/examples/client.rs (97%) rename {quicr => quinn}/examples/interop.rs (96%) rename {quicr => quinn}/examples/server.rs (94%) rename {quicr => quinn}/src/lib.rs (98%) diff --git a/Cargo.toml b/Cargo.toml index 435d51d7d..3cc4d5216 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["quicr", "quicr-core"] +members = ["quinn", "quinn-proto"] diff --git a/README.md b/README.md index 2cc2e0f94..78d592c3c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build status](https://api.travis-ci.org/djc/quinn.svg?branch=master)](https://travis-ci.org/djc/quinn) [![codecov](https://codecov.io/gh/djc/quinn/branch/master/graph/badge.svg)](https://codecov.io/gh/djc/quinn) [![Chat](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/djc/quinn) -[![Crates.io](https://img.shields.io/crates/v/quicr.svg)](https://crates.io/crates/quicr) +[![Crates.io](https://img.shields.io/crates/v/quicr.svg)](https://crates.io/crates/quinn) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE-MIT) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE-APACHE) diff --git a/quicr-core/Cargo.toml b/quinn-proto/Cargo.toml similarity index 97% rename from quicr-core/Cargo.toml rename to quinn-proto/Cargo.toml index 135880b87..b324180d8 100644 --- a/quicr-core/Cargo.toml +++ b/quinn-proto/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quicr-core" +name = "quinn-proto" version = "0.4.0" authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] license = "MIT/Apache-2.0" diff --git a/quicr-core/examples/connect.rs b/quinn-proto/examples/connect.rs similarity index 98% rename from quicr-core/examples/connect.rs rename to quinn-proto/examples/connect.rs index ab9c1fbf0..b0ebc70a6 100644 --- a/quicr-core/examples/connect.rs +++ b/quinn-proto/examples/connect.rs @@ -1,4 +1,4 @@ -extern crate quicr_core as quicr; +extern crate quinn_proto as quinn; extern crate rand; #[macro_use] extern crate failure; @@ -11,7 +11,7 @@ use std::net::{SocketAddr, SocketAddrV6, ToSocketAddrs, UdpSocket}; use std::time::{Duration, Instant}; use failure::Error; -use quicr::{Config, Directionality, Endpoint, Event, Io, ReadError, Timer}; +use quinn::{Config, Directionality, Endpoint, Event, Io, ReadError, Timer}; use slog::{Drain, Logger}; fn main() { diff --git a/quicr-core/src/coding.rs b/quinn-proto/src/coding.rs similarity index 100% rename from quicr-core/src/coding.rs rename to quinn-proto/src/coding.rs diff --git a/quicr-core/src/connection.rs b/quinn-proto/src/connection.rs similarity index 100% rename from quicr-core/src/connection.rs rename to quinn-proto/src/connection.rs diff --git a/quicr-core/src/crypto.rs b/quinn-proto/src/crypto.rs similarity index 100% rename from quicr-core/src/crypto.rs rename to quinn-proto/src/crypto.rs diff --git a/quicr-core/src/endpoint.rs b/quinn-proto/src/endpoint.rs similarity index 100% rename from quicr-core/src/endpoint.rs rename to quinn-proto/src/endpoint.rs diff --git a/quicr-core/src/frame.rs b/quinn-proto/src/frame.rs similarity index 100% rename from quicr-core/src/frame.rs rename to quinn-proto/src/frame.rs diff --git a/quicr-core/src/lib.rs b/quinn-proto/src/lib.rs similarity index 100% rename from quicr-core/src/lib.rs rename to quinn-proto/src/lib.rs diff --git a/quicr-core/src/memory_stream.rs b/quinn-proto/src/memory_stream.rs similarity index 100% rename from quicr-core/src/memory_stream.rs rename to quinn-proto/src/memory_stream.rs diff --git a/quicr-core/src/packet.rs b/quinn-proto/src/packet.rs similarity index 100% rename from quicr-core/src/packet.rs rename to quinn-proto/src/packet.rs diff --git a/quicr-core/src/range_set.rs b/quinn-proto/src/range_set.rs similarity index 100% rename from quicr-core/src/range_set.rs rename to quinn-proto/src/range_set.rs diff --git a/quicr-core/src/stream.rs b/quinn-proto/src/stream.rs similarity index 100% rename from quicr-core/src/stream.rs rename to quinn-proto/src/stream.rs diff --git a/quicr-core/src/tests.rs b/quinn-proto/src/tests.rs similarity index 100% rename from quicr-core/src/tests.rs rename to quinn-proto/src/tests.rs diff --git a/quicr-core/src/transport_error.rs b/quinn-proto/src/transport_error.rs similarity index 100% rename from quicr-core/src/transport_error.rs rename to quinn-proto/src/transport_error.rs diff --git a/quicr-core/src/transport_parameters.rs b/quinn-proto/src/transport_parameters.rs similarity index 100% rename from quicr-core/src/transport_parameters.rs rename to quinn-proto/src/transport_parameters.rs diff --git a/quicr-core/src/varint.rs b/quinn-proto/src/varint.rs similarity index 100% rename from quicr-core/src/varint.rs rename to quinn-proto/src/varint.rs diff --git a/quicr/Cargo.toml b/quinn/Cargo.toml similarity index 92% rename from quicr/Cargo.toml rename to quinn/Cargo.toml index f93b0a2cf..7bb62dbf1 100644 --- a/quicr/Cargo.toml +++ b/quinn/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quicr" +name = "quinn" version = "0.4.0" authors = ["Benjamin Saunders ", "Dirkjan Ochtman "] license = "MIT/Apache-2.0" @@ -19,7 +19,7 @@ bytes = "0.4.7" failure = "0.1" fnv = "1.0.6" futures = "0.1.21" -quicr-core = { path = "../quicr-core", version = "0.4.0" } +quinn-proto = { path = "../quinn-proto", version = "0.4.0" } rand = "0.4" rustls = { version = "0.14", features = ["quic"] } slog = "2.1" diff --git a/quicr/examples/client.rs b/quinn/examples/client.rs similarity index 97% rename from quicr/examples/client.rs rename to quinn/examples/client.rs index 08307c626..7739c6fa3 100644 --- a/quicr/examples/client.rs +++ b/quinn/examples/client.rs @@ -1,4 +1,4 @@ -extern crate quicr; +extern crate quinn; extern crate tokio; #[macro_use] extern crate failure; @@ -90,7 +90,7 @@ fn run(log: Logger, options: Opt) -> Result<()> { } */ - let mut builder = quicr::Endpoint::new(); + let mut builder = quinn::Endpoint::new(); builder.logger(log.clone()); if options.keylog { builder.enable_keylog(); @@ -130,7 +130,7 @@ fn run(log: Logger, options: Opt) -> Result<()> { "request sent at {}", duration_secs(&(response_start - start)) ); - quicr::read_to_end(stream, usize::max_value()) + quinn::read_to_end(stream, usize::max_value()) .map_err(|e| format_err!("failed to read response: {}", e)) .map(move |x| (x, response_start)) }).and_then(move |((_, data), response_start)| { diff --git a/quicr/examples/interop.rs b/quinn/examples/interop.rs similarity index 96% rename from quicr/examples/interop.rs rename to quinn/examples/interop.rs index d53cc7b29..18285d369 100644 --- a/quicr/examples/interop.rs +++ b/quinn/examples/interop.rs @@ -1,4 +1,4 @@ -extern crate quicr; +extern crate quinn; extern crate tokio; #[macro_use] extern crate failure; @@ -59,7 +59,7 @@ fn run(log: Logger, options: Opt) -> Result<()> { let mut runtime = Runtime::new()?; - let mut builder = quicr::Endpoint::new(); + let mut builder = quinn::Endpoint::new(); builder.logger(log.clone()); if options.keylog { builder.enable_keylog(); @@ -174,13 +174,13 @@ fn run(log: Logger, options: Opt) -> Result<()> { Ok(()) } -fn get(stream: quicr::Stream) -> impl Future, Error = Error> { +fn get(stream: quinn::Stream) -> impl Future, Error = Error> { tokio::io::write_all(stream, b"GET /index.html\r\n".to_owned()) .map_err(|e| format_err!("failed to send request: {}", e)) .and_then(|(stream, _)| { tokio::io::shutdown(stream).map_err(|e| format_err!("failed to shutdown stream: {}", e)) }).and_then(move |stream| { - quicr::read_to_end(stream, usize::max_value()) + quinn::read_to_end(stream, usize::max_value()) .map_err(|e| format_err!("failed to read response: {}", e)) }).map(|(_, data)| data) } diff --git a/quicr/examples/server.rs b/quinn/examples/server.rs similarity index 94% rename from quicr/examples/server.rs rename to quinn/examples/server.rs index 4ff7d546f..1207fea44 100644 --- a/quicr/examples/server.rs +++ b/quinn/examples/server.rs @@ -1,4 +1,4 @@ -extern crate quicr; +extern crate quinn; extern crate tokio; #[macro_use] extern crate failure; @@ -105,10 +105,10 @@ fn run(log: Logger, options: Opt) -> Result<()> { let mut runtime = Runtime::new()?; - let mut builder = quicr::Endpoint::new(); + let mut builder = quinn::Endpoint::new(); builder .logger(log.clone()) - .config(quicr::Config { + .config(quinn::Config { max_remote_bi_streams: 64, ..Default::default() }).listen(); @@ -140,8 +140,8 @@ fn run(log: Logger, options: Opt) -> Result<()> { Ok(()) } -fn handle_connection(root: &PathBuf, log: &Logger, conn: quicr::NewConnection) { - let quicr::NewConnection { +fn handle_connection(root: &PathBuf, log: &Logger, conn: quinn::NewConnection) { + let quinn::NewConnection { incoming, connection, } = conn; @@ -164,10 +164,10 @@ fn handle_connection(root: &PathBuf, log: &Logger, conn: quicr::NewConnection) { ); } -fn handle_request(root: &PathBuf, log: &Logger, stream: quicr::NewStream) { +fn handle_request(root: &PathBuf, log: &Logger, stream: quinn::NewStream) { let stream = match stream { - quicr::NewStream::Bi(stream) => stream, - quicr::NewStream::Uni(_) => unreachable!(), // config.max_remote_uni_streams is defaulted to 0 + quinn::NewStream::Bi(stream) => stream, + quinn::NewStream::Uni(_) => unreachable!(), // config.max_remote_uni_streams is defaulted to 0 }; let root = root.clone(); let log = log.clone(); @@ -175,7 +175,7 @@ fn handle_request(root: &PathBuf, log: &Logger, stream: quicr::NewStream) { let log3 = log.clone(); tokio_current_thread::spawn( - quicr::read_to_end(stream, 64 * 1024) // Read the request, which must be at most 64KiB + quinn::read_to_end(stream, 64 * 1024) // Read the request, which must be at most 64KiB .map_err(|e| format_err!("failed reading request: {}", e)) .and_then(move |(stream, req)| { let mut escaped = String::new(); diff --git a/quicr/src/lib.rs b/quinn/src/lib.rs similarity index 98% rename from quicr/src/lib.rs rename to quinn/src/lib.rs index f7f2d0696..973bf0224 100644 --- a/quicr/src/lib.rs +++ b/quinn/src/lib.rs @@ -11,12 +11,12 @@ //! //! ``` //! # extern crate tokio; -//! # extern crate quicr; +//! # extern crate quinn; //! # extern crate futures; //! # use futures::Future; //! # fn main() { //! let mut runtime = tokio::runtime::current_thread::Runtime::new().unwrap(); -//! let mut builder = quicr::Endpoint::new(); +//! let mut builder = quinn::Endpoint::new(); //! // //! let (endpoint, driver, _) = builder.bind("[::]:0").unwrap(); //! runtime.spawn(driver.map_err(|e| panic!("IO error: {}", e))); @@ -47,7 +47,7 @@ //! can be used to provide encryption alone. #![warn(missing_docs)] -extern crate quicr_core as quicr; +extern crate quinn_proto as quinn; extern crate tokio_io; extern crate tokio_reactor; extern crate tokio_timer; @@ -86,9 +86,9 @@ use tokio_io::{AsyncRead, AsyncWrite}; use tokio_timer::Delay; use tokio_udp::UdpSocket; -use quicr::{ConnectionHandle, Directionality, Side, StreamId}; +use quinn::{ConnectionHandle, Directionality, Side, StreamId}; -pub use quicr::{ClientConfig, Config, ConnectError, ConnectionError, ConnectionId, ListenKeys}; +pub use quinn::{ClientConfig, Config, ConnectError, ConnectionError, ConnectionId, ListenKeys}; /// Errors that can occur during the construction of an `Endpoint`. #[derive(Debug, Fail)] @@ -113,9 +113,9 @@ pub enum Error { WebPki(webpki::Error), } -impl From for Error { - fn from(x: quicr::EndpointError) -> Self { - use quicr::EndpointError::*; +impl From for Error { + fn from(x: quinn::EndpointError) -> Self { + use quinn::EndpointError::*; match x { Tls(x) => Error::Tls(x), Keylog(x) => Error::Keylog(x), @@ -134,7 +134,7 @@ impl From for Error { struct EndpointInner { log: Logger, socket: UdpSocket, - inner: quicr::Endpoint, + inner: quinn::Endpoint, outgoing: VecDeque<(SocketAddrV6, Box<[u8]>)>, epoch: Instant, pending: FnvHashMap, @@ -314,7 +314,7 @@ impl<'a> EndpointBuilder<'a> { let rc = Rc::new(RefCell::new(EndpointInner { log: self.logger.clone(), socket: socket, - inner: quicr::Endpoint::new(self.logger, self.config, self.listen)?, + inner: quinn::Endpoint::new(self.logger, self.config, self.listen)?, outgoing: VecDeque::new(), epoch: Instant::now(), pending: FnvHashMap::default(), @@ -442,7 +442,7 @@ pub struct NewConnection { } impl NewConnection { - fn new(endpoint: Endpoint, handle: quicr::ConnectionHandle) -> Self { + fn new(endpoint: Endpoint, handle: quinn::ConnectionHandle) -> Self { let conn = Rc::new(ConnectionInner { endpoint: Endpoint(endpoint.0.clone()), conn: handle, @@ -506,7 +506,7 @@ impl Future for Driver { } } while let Some((connection, event)) = endpoint.inner.poll() { - use quicr::Event::*; + use quinn::Event::*; match event { Connected { .. } => { let _ = endpoint @@ -616,7 +616,7 @@ impl Future for Driver { endpoint.outgoing.pop_front(); } while let Some(io) = endpoint.inner.poll_io(now) { - use quicr::Io::*; + use quinn::Io::*; match io { Transmit { destination, @@ -642,7 +642,7 @@ impl Future for Driver { } TimerStart { connection, - timer: timer @ quicr::Timer::Close, + timer: timer @ quinn::Timer::Close, time, } => { let instant = endpoint.epoch + duration_micros(time); @@ -663,7 +663,7 @@ impl Future for Driver { .pending .entry(connection) .or_insert_with(|| Pending::new(None)); - use quicr::Timer::*; + use quinn::Timer::*; let mut cancel = match timer { LossDetection => &mut pending.cancel_loss_detect, Idle => &mut pending.cancel_idle, @@ -687,7 +687,7 @@ impl Future for Driver { trace!(endpoint.log, "timer stop"; "timer" => ?timer); // If a connection was lost, we already canceled its loss/idle timers. if let Some(pending) = endpoint.pending.get_mut(&connection) { - use quicr::Timer::*; + use quinn::Timer::*; match timer { LossDetection => { pending.cancel_loss_detect.take().map(|x| { @@ -972,7 +972,7 @@ impl Stream { impl Write for Stream { fn poll_write(&mut self, buf: &[u8]) -> Poll { let mut endpoint = self.conn.endpoint.0.borrow_mut(); - use quicr::WriteError::*; + use quinn::WriteError::*; let n = match endpoint.inner.write(self.conn.conn, self.stream, buf) { Ok(n) => n, Err(Blocked) => { @@ -1028,7 +1028,7 @@ impl Write for Stream { impl Read for Stream { fn poll_read_unordered(&mut self) -> Poll<(Bytes, u64), ReadError> { let endpoint = &mut *self.conn.endpoint.0.borrow_mut(); - use quicr::ReadError::*; + use quinn::ReadError::*; let pending = endpoint.pending.get_mut(&self.conn.conn).unwrap(); match endpoint.inner.read_unordered(self.conn.conn, self.stream) { Ok((bytes, offset)) => Ok(Async::Ready((bytes, offset))), @@ -1052,7 +1052,7 @@ impl Read for Stream { fn poll_read(&mut self, buf: &mut [u8]) -> Poll { let endpoint = &mut *self.conn.endpoint.0.borrow_mut(); - use quicr::ReadError::*; + use quinn::ReadError::*; let pending = endpoint.pending.get_mut(&self.conn.conn).unwrap(); match endpoint.inner.read(self.conn.conn, self.stream, buf) { Ok(n) => Ok(Async::Ready(n)), @@ -1249,13 +1249,13 @@ pub enum ReadError { struct Timer { conn: ConnectionHandle, - ty: quicr::Timer, + ty: quinn::Timer, delay: Delay, cancel: Option>, } impl Future for Timer { - type Item = Option<(ConnectionHandle, quicr::Timer)>; + type Item = Option<(ConnectionHandle, quinn::Timer)>; type Error = (); // FIXME fn poll(&mut self) -> Poll { if let Some(ref mut cancel) = self.cancel {