Skip to content

Commit

Permalink
transports/tls: Add libp2p-tls as per spec (#2945)
Browse files Browse the repository at this point in the history
Co-authored-by: David Craven <david@craven.ch>
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
Co-authored-by: Elena Frank <elena.frank@protonmail.com>
Co-authored-by: Max Inden <mail@max-inden.de
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Roman Proskuryakov <r.proskuryakoff@gmail.com>
  • Loading branch information
6 people committed Oct 24, 2022
1 parent a0adaf6 commit 159a10b
Show file tree
Hide file tree
Showing 23 changed files with 1,211 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [`libp2p-uds` CHANGELOG](transports/uds/CHANGELOG.md)
- [`libp2p-wasm-ext` CHANGELOG](transports/wasm-ext/CHANGELOG.md)
- [`libp2p-websocket` CHANGELOG](transports/websocket/CHANGELOG.md)
- [`libp2p-tls` CHANGELOG](transports/tls/CHANGELOG.md)

## Multiplexers

Expand Down Expand Up @@ -65,6 +66,8 @@

See [PR 2962].

- Introduce [`libp2p-tls` `v0.1.0`](transports/tls/CHANGELOG.md#010). See [PR 2945].

- Update individual crates.
- Update to [`libp2p-autonat` `v0.8.0`](protocols/autonat/CHANGELOG.md#0080).
- Update to [`libp2p-core` `v0.37.0`](core/CHANGELOG.md#0370).
Expand Down Expand Up @@ -94,6 +97,7 @@

[PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918
[PR 2962]: https://github.com/libp2p/rust-libp2p/pull/2962
[PR 2945]: https://github.com/libp2p/rust-libp2p/pull/2945

# 0.48.0

Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ full = [
"serde",
"tcp",
"tokio",
"tls",
"uds",
"wasm-bindgen",
"wasm-ext",
Expand All @@ -52,6 +53,7 @@ floodsub = ["dep:libp2p-floodsub"]
identify = ["dep:libp2p-identify", "libp2p-metrics?/identify"]
kad = ["dep:libp2p-kad", "libp2p-metrics?/kad"]
gossipsub = ["dep:libp2p-gossipsub", "libp2p-metrics?/gossipsub"]
tls = ["dep:libp2p-tls"]
metrics = ["dep:libp2p-metrics"]
mdns = ["dep:libp2p-mdns"]
mplex = ["dep:libp2p-mplex"]
Expand Down Expand Up @@ -118,6 +120,7 @@ libp2p-dns = { version = "0.37.0", path = "transports/dns", optional = true }
libp2p-mdns = { version = "0.41.0", path = "protocols/mdns", optional = true }
libp2p-tcp = { version = "0.37.0", path = "transports/tcp", optional = true }
libp2p-websocket = { version = "0.39.0", path = "transports/websocket", optional = true }
libp2p-tls = { version = "0.1.0-alpha", path = "transports/tls", optional = true }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
libp2p-gossipsub = { version = "0.42.1", path = "protocols/gossipsub", optional = true }
Expand Down Expand Up @@ -157,6 +160,7 @@ members = [
"transports/deflate",
"transports/dns",
"transports/noise",
"transports/tls",
"transports/plaintext",
"transports/pnet",
"transports/tcp",
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ pub use libp2p_swarm as swarm;
#[cfg_attr(docsrs, doc(cfg(feature = "tcp")))]
#[doc(inline)]
pub use libp2p_tcp as tcp;
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
#[doc(inline)]
pub use libp2p_tls as tls;
#[cfg(feature = "uds")]
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
#[doc(inline)]
Expand Down
3 changes: 3 additions & 0 deletions transports/tls/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0 [unreleased]

Initial release.
36 changes: 36 additions & 0 deletions transports/tls/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "libp2p-tls"
version = "0.1.0-alpha"
edition = "2021"
license = "MIT"
exclude = ["src/test_assets"]

[dependencies]
futures = { version = "0.3.24", default-features = false }
futures-rustls = "0.22.2"
libp2p-core = { version = "0.37.0", path = "../../core" }
rcgen = "0.9.2"
ring = "0.16.20"
thiserror = "1.0.36"
webpki = "0.22.0"
x509-parser = "0.14.0"
yasna = "0.5.0"

# Exposed dependencies. Breaking changes to these are breaking changes to us.
[dependencies.rustls]
version = "0.20.7"
default-features = false
features = ["dangerous_configuration"] # Must enable this to allow for custom verification code.

[dev-dependencies]
hex = "0.4.3"
hex-literal = "0.3.4"
libp2p = { path = "../..", features = ["yamux"], default-features = false }
tokio = { version = "1.21.1", features = ["full"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
Loading

0 comments on commit 159a10b

Please sign in to comment.