Commit d1ecdfd5 authored by trinity-1686a's avatar trinity-1686a 💜
Browse files

update for 0.1.0

parent eea99086
......@@ -6,8 +6,8 @@ edition = "2018"
[dependencies]
# use fixed commits because Arti does not have a stable Rust API yet
arti-client = { version = "=0.0.4", features=["static"]}
tor-rtcompat = "=0.0.4"
arti-client = { version = "0.1", features=["static"]}
tor-rtcompat = "0.1"
# helpers
anyhow = "1.0.52"
......
......@@ -79,12 +79,12 @@ endif
cargo-ndk:
ifeq ($(shell which cargo-ndk),)
ifeq ($(shell command -v cargo-ndk),)
cargo install cargo-ndk
endif
cbindgen:
ifeq ($(shell which cbindgen),)
ifeq ($(shell command -v cbindgen),)
cargo install cbindgen
endif
......
......@@ -5,7 +5,7 @@ use arti_client::{config::TorClientConfigBuilder, TorClient};
use tor_rtcompat::BlockOn;
fn run_arti(to: &str, cache: &str) -> Result<String> {
let runtime = tor_rtcompat::create_runtime()?;
let runtime = tor_rtcompat::PreferredRuntime::create()?;
let rt_copy = runtime.clone();
let config = TorClientConfigBuilder::from_directories(
......@@ -14,12 +14,16 @@ fn run_arti(to: &str, cache: &str) -> Result<String> {
)
.build()?;
rt_copy.block_on(async {
let client = TorClient::bootstrap(runtime, config).await?;
let client = TorClient::with_runtime(runtime)
.config(config)
.create_bootstrapped().await?;
let mut stream = client.connect((to, 80)).await?;
stream.write_all(b"GET / HTTP/1.1\r\nHost: ").await?;
stream.write_all(to.as_bytes()).await?;
stream.write_all(b"\r\nConnection: close\r\n\r\n").await?;
stream.close().await?;
let mut res = Vec::new();
stream.read_to_end(&mut res).await?;
let message = std::str::from_utf8(&res)?;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment