libtor
is a Rust crate for bundling inside your project a fully-running Tor daemon.
It exposes a nicer interface to operate it compared to the bare-bones version, libtor-sys.
If you need further instructions on how to build or cross-compile the project, you should refer to the libtor-sys
README.md.
libtor
makes it easier for projects on multiple platforms to use Tor without depending on the user to configure complex proxy settings from other external software.
``` use libtor::{Tor, TorFlag, TorAddress, HiddenServiceVersion};
Tor::new() .flag(TorFlag::DataDirectory("/tmp/tor-rust".into())) .flag(TorFlag::SocksPort(19050)) .flag(TorFlag::HiddenServiceDir("/tmp/tor-rust/hs-dir".into())) .flag(TorFlag::HiddenServiceVersion(HiddenServiceVersion::V3)) .flag(TorFlag::HiddenServicePort(TorAddress::Port(8000), None.into())) .start()?; ```
Since Tor uses internally some static variables to keep its state, keep in mind that you can't start more than one Tor instance per process.
The currently supported platforms are:
mingw
Coming Soon :tm::
The following dependencies are needed:
- openssl
- pkg-config
- file
- the "usual" C build tools: a compiler, automake
, autoconf