summaryrefslogtreecommitdiff
path: root/crates/tor-ptmgr/examples/run-pt.rs
blob: 5657e81f58da388d25000ca305d195cafda2d1ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! Very very very basic soak test that runs obfs4proxy.

use anyhow::Result;
use tor_ptmgr::ipc::{
    PluggableClientTransport, PluggableTransport, PtClientParameters, PtCommonParameters,
};
use tor_rtcompat::PreferredRuntime;
use tracing::info;

#[tokio::main]
async fn main() -> Result<()> {
    tracing_subscriber::fmt::init();
    let common_params = PtCommonParameters::builder()
        .state_location("/tmp/arti-pt".into())
        .build()
        .unwrap();
    let client_params = PtClientParameters::builder()
        .transports(vec!["obfs4".parse().unwrap()])
        .build()
        .unwrap();
    let mut pt =
        PluggableClientTransport::new("./obfs4proxy".into(), vec![], common_params, client_params);
    pt.launch(PreferredRuntime::current()?).await?;
    loop {
        info!("message: {:?}", pt.next_message().await?);
    }
}