Rename crates from quicr{,-core} to quinn{,-proto}

This commit is contained in:
Dirkjan Ochtman
2018-10-02 21:57:46 +02:00
parent 0a5a9fa70e
commit 3da54b178c
23 changed files with 44 additions and 44 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
[workspace]
members = ["quicr", "quicr-core"]
members = ["quinn", "quinn-proto"]
+1 -1
View File
@@ -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)
@@ -1,5 +1,5 @@
[package]
name = "quicr-core"
name = "quinn-proto"
version = "0.4.0"
authors = ["Benjamin Saunders <ben.e.saunders@gmail.com>", "Dirkjan Ochtman <dirkjan@ochtman.nl>"]
license = "MIT/Apache-2.0"
@@ -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() {
+2 -2
View File
@@ -1,5 +1,5 @@
[package]
name = "quicr"
name = "quinn"
version = "0.4.0"
authors = ["Benjamin Saunders <ben.e.saunders@gmail.com>", "Dirkjan Ochtman <dirkjan@ochtman.nl>"]
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"
@@ -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)| {
@@ -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<Item = Box<[u8]>, Error = Error> {
fn get(stream: quinn::Stream) -> impl Future<Item = Box<[u8]>, 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)
}
@@ -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();
+21 -21
View File
@@ -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();
//! // <configure builder>
//! 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<quicr::EndpointError> for Error {
fn from(x: quicr::EndpointError) -> Self {
use quicr::EndpointError::*;
impl From<quinn::EndpointError> 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<webpki::Error> for Error {
struct EndpointInner {
log: Logger,
socket: UdpSocket,
inner: quicr::Endpoint,
inner: quinn::Endpoint,
outgoing: VecDeque<(SocketAddrV6, Box<[u8]>)>,
epoch: Instant,
pending: FnvHashMap<ConnectionHandle, Pending>,
@@ -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<usize, WriteError> {
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<usize, 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(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<oneshot::Receiver<()>>,
}
impl Future for Timer {
type Item = Option<(ConnectionHandle, quicr::Timer)>;
type Item = Option<(ConnectionHandle, quinn::Timer)>;
type Error = (); // FIXME
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Some(ref mut cancel) = self.cancel {