You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
705 B
21 lines
705 B
use libtor::{Tor, TorFlag, Error as libtorError, log as libtorLog};
|
|
|
|
pub struct GuiTor {}
|
|
impl GuiTor {
|
|
pub fn start_tor() -> std::thread::JoinHandle<Result<u8, libtorError>> {
|
|
let t: std::thread::JoinHandle<_> = Tor::new()
|
|
.flag(TorFlag::DataDirectory(crate::TOR_DATA.to_owned()))
|
|
.flag(TorFlag::SocksPort(19050))
|
|
.flag(TorFlag::LogTo(libtorLog::LogLevel::Info, libtorLog::LogDestination::File(crate::TOR_LOG.to_string())))
|
|
.start_background();
|
|
return t
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
pub fn clear_log() -> std::io::Result<()> {
|
|
let r: std::io::Result<()> = std::fs::write(crate::TOR_LOG, "");
|
|
return r
|
|
}
|
|
}
|
|
|