Crates.io | arti-axum |
lib.rs | arti-axum |
version | 0.1.0 |
source | src |
created_at | 2024-02-14 23:23:37.289687 |
updated_at | 2024-02-14 23:23:37.289687 |
description | axum::serve for onion services |
homepage | https://github.com/jgraef/arti-axum |
repository | https://github.com/jgraef/arti-axum |
max_upload_size | |
id | 1140322 |
size | 122,559 |
arti-axum
This crate allows you to run your axum http server as a tor hidden service using arti.
For a full example, take a look at hello_world.rs
.
let tor_client = TorClient::create_bootstrapped(TorClientConfig::default()).await?;
let (onion_service, rend_requests) = tor_client.launch_onion_service(
OnionServiceConfigBuilder::default()
.nickname("hello-world".to_owned().try_into().unwrap())
.build()?,
)?;
let stream_requests = handle_rend_requests(rend_requests);
let app = Router::new().route("/", routing::get(|| async { "Hello, World!" }));
println!("serving at: http://{}", onion_service.onion_name().unwrap());
arti_axum::serve(stream_requests, app).await;