MCPcopy Index your code
hub / github.com/MagicalBitcoin/libtor

github.com/MagicalBitcoin/libtor @47.13.0+0.4.7.x

Chat with this repo
repository ↗ · DeepWiki ↗ · release 47.13.0+0.4.7.x ↗ · + Follow
43 symbols 56 edges 6 files 5 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

libtor

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.

Example

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.

Supported platforms

The currently supported platforms are:

  • Linux (tested on Fedora 30 and Ubuntu Xenial)
  • Android through the NDK
  • MacOS
  • iOS
  • Windows cross-compiled from Linux with mingw

Coming Soon :tm::

  • Windows (natively built)

Dependencies

The following dependencies are needed: - openssl - pkg-config - file - the "usual" C build tools: a compiler, automake, autoconf

Extension points exported contracts — how you extend this code

Joiner (Interface)
(no doc) [2 implementers]
libtor/src/utils.rs
Expand (Interface)
(no doc)
libtor/src/lib.rs

Core symbols most depended-on inside this repo

flag
called by 5
libtor/src/lib.rs
split_first_space_args
called by 3
libtor-derive/src/lib.rs
joiner
called by 1
libtor/src/utils.rs
start
called by 1
libtor/src/lib.rs
start_background
called by 1
libtor/src/lib.rs
generate_hashed_password
called by 1
libtor/src/lib.rs
generate_test
called by 1
libtor-derive/src/lib.rs
new
called by 0
libtor/src/utils.rs

Shape

Method 14
Enum 13
Class 7
Function 7
Interface 2

Languages

Rust100%

Modules by API surface

libtor/src/lib.rs18 symbols
libtor/src/utils.rs9 symbols
libtor-derive/src/lib.rs6 symbols
libtor/src/log.rs4 symbols
libtor/src/ports.rs3 symbols
libtor/src/hs.rs3 symbols

For agents

$ claude mcp add libtor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page