parent
b281d8c27d
commit
5dfd1628a2
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fn get_wow_price() -> String {
|
||||||
|
let url: &str = "https://tradeogre.com/api/v1/ticker/BTC-WOW";
|
||||||
|
let client: reqwest::blocking::Client = reqwest::blocking::ClientBuilder::new()
|
||||||
|
.timeout(std::time::Duration::from_secs(10))
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
let res: String = client.get(url)
|
||||||
|
.send()
|
||||||
|
.unwrap()
|
||||||
|
.json()
|
||||||
|
.unwrap();
|
||||||
|
return res
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clear_log() -> std::io::Result<()> {
|
||||||
|
let r: std::io::Result<()> = std::fs::write(crate::TOR_LOG, "");
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in new issue