arti-hyper: Move hyper example from arti-client
Code motion and consequential dependency adjustments.
This commit is contained in:
parent
0f80be6b35
commit
0cf9751d7f
|
@ -126,7 +126,6 @@ dependencies = [
|
||||||
"directories",
|
"directories",
|
||||||
"futures",
|
"futures",
|
||||||
"humantime-serde",
|
"humantime-serde",
|
||||||
"hyper",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"postage",
|
"postage",
|
||||||
|
@ -168,8 +167,13 @@ dependencies = [
|
||||||
name = "arti-hyper"
|
name = "arti-hyper"
|
||||||
version = "0.0.4"
|
version = "0.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
"arti-client",
|
"arti-client",
|
||||||
"hyper",
|
"hyper",
|
||||||
|
"pin-project",
|
||||||
|
"tokio",
|
||||||
|
"tor-rtcompat",
|
||||||
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -48,7 +48,6 @@ thiserror = "1"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tor-rtcompat = { path="../tor-rtcompat", version = "0.0.4", features=["tokio", "native-tls" ] }
|
tor-rtcompat = { path="../tor-rtcompat", version = "0.0.4", features=["tokio", "native-tls" ] }
|
||||||
tokio-crate = { package = "tokio", version = "1.4", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] }
|
tokio-crate = { package = "tokio", version = "1.4", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] }
|
||||||
hyper = { version = "0.14", features = ["http1", "client", "runtime"] }
|
|
||||||
pin-project = "1"
|
pin-project = "1"
|
||||||
tokio-util = { version = "0.6", features = ["compat"] }
|
tokio-util = { version = "0.6", features = ["compat"] }
|
||||||
anyhow = "1.0.23"
|
anyhow = "1.0.23"
|
||||||
|
|
|
@ -12,8 +12,8 @@ repository="https://gitlab.torproject.org/tpo/core/arti.git/"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "native-tls" ]
|
default = [ "native-tls" ]
|
||||||
native-tls = [ "arti-client/native-tls" ]
|
native-tls = [ "arti-client/native-tls", "tor-rtcompat/native-tls" ]
|
||||||
rustls = [ "arti-client/rustls" ]
|
rustls = [ "arti-client/rustls", "tor-rtcompat/rustls" ]
|
||||||
static = [ "arti-client/static" ]
|
static = [ "arti-client/static" ]
|
||||||
|
|
||||||
# Enable experimental APIs that are not yet officially supported.
|
# Enable experimental APIs that are not yet officially supported.
|
||||||
|
@ -25,5 +25,10 @@ experimental-api = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arti-client = { path="../arti-client", version = "0.0.4"}
|
arti-client = { path="../arti-client", version = "0.0.4"}
|
||||||
hyper = { version = "0.14", features = ["http1", "client", "runtime"] }
|
hyper = { version = "0.14", features = ["http1", "client", "runtime"] }
|
||||||
|
pin-project = "1"
|
||||||
|
tokio = { package = "tokio", version = "1.4", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] }
|
||||||
|
tor-rtcompat = { path="../tor-rtcompat", version = "0.0.4", features=["tokio"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
anyhow = "1.0.23"
|
||||||
|
tracing-subscriber = "0.3.0"
|
||||||
|
|
|
@ -12,7 +12,6 @@ use std::io::Error;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||||
use tokio_crate as tokio;
|
|
||||||
use tor_rtcompat::tokio::TokioNativeTlsRuntime;
|
use tor_rtcompat::tokio::TokioNativeTlsRuntime;
|
||||||
use tor_rtcompat::Runtime;
|
use tor_rtcompat::Runtime;
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ async fn main() -> Result<()> {
|
||||||
// on Linux platforms)
|
// on Linux platforms)
|
||||||
let config = TorClientConfig::default();
|
let config = TorClientConfig::default();
|
||||||
// Arti needs an async runtime handle to spawn async tasks.
|
// Arti needs an async runtime handle to spawn async tasks.
|
||||||
let rt: TokioNativeTlsRuntime = tokio_crate::runtime::Handle::current().into();
|
let rt: TokioNativeTlsRuntime = tokio::runtime::Handle::current().into();
|
||||||
|
|
||||||
// We now let the Arti client start and bootstrap a connection to the network.
|
// We now let the Arti client start and bootstrap a connection to the network.
|
||||||
// (This takes a while to gather the necessary consensus state, etc.)
|
// (This takes a while to gather the necessary consensus state, etc.)
|
Loading…
Reference in New Issue