Skip to content

Commit

Permalink
Add libp2p-quic
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Oct 17, 2018
1 parent 5d1c54c commit df37fdb
Show file tree
Hide file tree
Showing 5 changed files with 491 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ libp2p-kad = { path = "./protocols/kad" }
libp2p-floodsub = { path = "./protocols/floodsub" }
libp2p-peerstore = { path = "./stores/peerstore" }
libp2p-ping = { path = "./protocols/ping" }
libp2p-quic = { path = "./transports/quic" }
libp2p-ratelimit = { path = "./transports/ratelimit" }
libp2p-relay = { path = "./transports/relay" }
libp2p-core = { path = "./core" }
Expand Down Expand Up @@ -68,6 +69,7 @@ members = [
"transports/tcp",
"transports/uds",
"transports/websocket",
"transports/quic",
"transports/timeout",
"transports/ratelimit",
]
12 changes: 11 additions & 1 deletion misc/multiaddr/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
convert::From,
fmt,
io::{Cursor, Write},
net::{Ipv4Addr, Ipv6Addr},
net::{IpAddr, Ipv4Addr, Ipv6Addr},
str::{self, FromStr}
};
use unsigned_varint::{encode, decode};
Expand Down Expand Up @@ -383,6 +383,16 @@ impl<'a> fmt::Display for Protocol<'a> {
}
}

impl<'a> From<IpAddr> for Protocol<'a> {
#[inline]
fn from(addr: IpAddr) -> Self {
match addr {
IpAddr::V4(addr) => Protocol::Ip4(addr),
IpAddr::V6(addr) => Protocol::Ip6(addr),
}
}
}

impl<'a> From<Ipv4Addr> for Protocol<'a> {
#[inline]
fn from(addr: Ipv4Addr) -> Self {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub extern crate libp2p_floodsub as floodsub;
pub extern crate libp2p_mplex as mplex;
pub extern crate libp2p_peerstore as peerstore;
pub extern crate libp2p_ping as ping;
pub extern crate libp2p_quic as quic;
pub extern crate libp2p_ratelimit as ratelimit;
pub extern crate libp2p_relay as relay;
pub extern crate libp2p_secio as secio;
Expand Down
19 changes: 19 additions & 0 deletions transports/quic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "libp2p-quic"
version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
edition = "2018"

[dependencies]
bytes = "0.4.9"
libp2p-core = { path = "../../core" }
log = "0.4.1"
fnv = "1.0"
futures = "0.1"
multiaddr = { path = "../../misc/multiaddr" }
openssl = "^0.10.6"
parking_lot = "0.5"
picoquic = { git = "https://github.com/bkchr/picoquic-rs", rev = "b27be6e9597ec9478c64722c9848522540bc8a38" }
tokio-core = "0.1" # TODO: remove once picoquic no longer needs it
tokio-io = "0.1"
Loading

0 comments on commit df37fdb

Please sign in to comment.