-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Upgrade arti_client to 0.24 (#18)
* feat: Upgrade arti_client to 0.24 * feat: force use of tokio / rustls, upgrade libp2p to 0.53, migrate example to new libp2p API * bump: Crate version to 0.2.0 * feat: use tracing to log connection establishement * Update Cargo.toml Co-authored-by: Hannes <[email protected]> * fix: revert removal of copyright, change of repository url, remove redundant features for tokio * fix: revert removal of example from Cargo.toml * feat: Add example for constructing tokio TorTransport * fix: use tokio-test for doctest * docs: Update readme to reflect changelogs * refactor: constructor method for onion transport in examples/ping-onion * fix: match ConnectionEstablished, OutgoingConnectionError in swarm event loop * refactor: add comments, switch order of functions to reduce diff * refactor: remove type alias for TorClientBuilder since generics have been removed * feat: add from_client constructor * fix: remaining clippy warnings --------- Co-authored-by: Hannes <[email protected]>
- Loading branch information
1 parent
36ecad6
commit 75d2540
Showing
6 changed files
with
160 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "libp2p-community-tor" | ||
version = "0.3.0-alpha" | ||
version = "0.4.0" | ||
edition = "2021" | ||
license = "MIT" | ||
resolver = "2" | ||
|
@@ -9,30 +9,20 @@ repository = "https://github.com/umgefahren/libp2p-tor" | |
authors = ["umgefahren <[email protected]>"] | ||
|
||
[dependencies] | ||
arti-client = { version = "0.8", default-features = false } | ||
async-std-crate = { package = "async-std", version = "1", optional = true, default-features = false } | ||
arti-client = "0.24.0" | ||
futures = "0.3" | ||
libp2p-core = { version = "0.39" } | ||
thiserror = "1" | ||
tokio-crate = { package = "tokio", version = "1", optional = true, default-features = false } | ||
tor-rtcompat = "0.8" | ||
libp2p = { version = "^0.53", default-features = false, features = ["tokio", "tcp", "tls"] } | ||
tor-rtcompat = { version = "0.24.0", features = ["tokio", "rustls"] } | ||
tokio = { version = "1.0", features = ["macros"] } | ||
tracing = "0.1.40" | ||
|
||
[dev-dependencies] | ||
libp2p = { version = "0.51", features = ["mplex", "noise", "ping", "yamux", "macros", "async-std"] } | ||
tokio-crate = { package = "tokio", version = "1", features = ["rt", "macros"] } | ||
async-std-crate = { package = "async-std", version = "1", features = ["attributes"] } | ||
|
||
[features] | ||
tokio = ["arti-client/tokio", "dep:tokio-crate"] | ||
async-std = ["arti-client/async-std", "dep:async-std-crate"] | ||
native-tls = ["arti-client/native-tls"] | ||
rustls = ["arti-client/rustls"] | ||
libp2p = { version = "0.53", default-features = false, features = ["tokio", "noise", "yamux", "ping", "noise", "macros", "tcp", "tls"] } | ||
tokio-test = "0.4.4" | ||
|
||
[[example]] | ||
name = "ping-onion" | ||
required-features = ["async-std", "rustls"] | ||
|
||
[package.metadata.docs.rs] | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
rustc-args = ["--cfg", "docsrs"] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,31 +21,20 @@ are dealing with. | |
|
||
### Add to your dependencies | ||
|
||
This won't work: | ||
```bash | ||
cargo add libp2p-community-tor@0.3.0-alpha | ||
cargo add libp2p-community-tor | ||
``` | ||
|
||
You have to choose a TLS provider **and** a runtime. | ||
The TLS providers are: | ||
This crate uses tokio with rustls for its runtime and TLS implementation. | ||
No other combinations are supported. | ||
|
||
- [`rustls`](https://github.com/rustls/rustls) | ||
- [`native-tls`](https://github.com/sfackler/rust-native-tls) | ||
|
||
The runtimes are: | ||
|
||
- [`tokio`](https://github.com/tokio-rs/tokio) | ||
- [`async-std`](https://github.com/async-rs/async-std) | ||
|
||
| | **rustls** | **native-tls** | | ||
|---------------|------------------------------------------------------------------|----------------------------------------------------------------------| | ||
| **tokio** | `cargo add [email protected] -F tokio,rustls` | `cargo add [email protected] -F tokio,native-tls` | | ||
| **async-std** | `cargo add [email protected] -F async-std,rustls` | `cargo add [email protected] -F async-std,native-tls` | | ||
|
||
### Example | ||
```rust | ||
let address = "/dns/www.torproject.org/tcp/1000".parse()?; | ||
let mut transport = libp2p_community_tor::AsyncStdNativeTlsTorTransport::bootstrapped().await?; | ||
let mut transport = libp2p_community_tor::TorTransport::bootstrapped().await?; | ||
// we have achieved tor connection | ||
let _conn = transport.dial(address)?.await?; | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.