Crates.io | Tor_Traffic_Router |
lib.rs | Tor_Traffic_Router |
version | 0.3.0 |
source | src |
created_at | 2024-02-25 19:22:39.026083 |
updated_at | 2024-03-13 20:04:29.946321 |
description | A Rust crate to install, manage, and utilize Tor for privacy-enhanced requests. |
homepage | |
repository | https://github.com/BDR-Pro/TorTrafficRouter |
max_upload_size | |
id | 1152723 |
size | 927,027 |
Welcome to Tor Traffic Router, a powerful Rust crate designed to make integrating Tor into your Rust applications as seamless as possible. With a strong focus on privacy, this crate ensures your network requests are enhanced with an additional layer of anonymity, leveraging the Tor network. Whether you're developing a new app that requires confidential communication or looking to add a privacy feature to an existing project, Tor Traffic Router has got you covered.
Before diving into Tor Traffic Router, ensure you have Rust installed on your machine. This crate is compatible with Rust edition 2021 and requires no additional setup beyond the Rust toolchain.
Add Tor Traffic Router to your Cargo.toml
:
[dependencies]
Tor_Traffic_Router = "0.3.0"
Here's a quick example to get you started:
use Tor_Traffic_Router::{config_file, is_tor_installed_unix, is_tor_installed_windows, install_tor, stop_tor, tor_proxy};
use std::env;
use reqwest::Client;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Configure Tor with a new hidden service
let hidden_service_config = format!(
"HiddenServiceDir {}\nHiddenServicePort 80 127.0.0.1:{}",
env::current_dir().unwrap().to_str().unwrap(),
8080
);
config_file("etc/tor/torrc", &hidden_service_config);
// Ensure Tor is installed and start it
let client = tor_proxy();
// Make a privacy-focused request
let res = client.get("http://check.torproject.org/api/ip").send().await?;
println!("Response: {:?}", res.text().await?);
stop_tor();
Ok(())
}
For more detailed information about each function and configuration options, please refer to the inline documentation within the code. Our GitHub repository also includes additional examples and usage scenarios to help you integrate Tor Traffic Router into your projects seamlessly.
/* //////////////////////////////////////////////////////////// */
/* // // */
/* // _______ ____ _____ ____ _ // */
/* // |__ __/ __ \| __ \ / __ \ (_) // */
/* // | | | | | | |__) | | | | |_ __ _ ___ _ __ // */
/* // | | | | | | _ / | | | | '_ \| |/ _ \| '_ \ // */
/* // | | | |__| | | \ \ | |__| | | | | | (_) | | | | // */
/* // |_| \____/|_| \_\ (_)____/|_| |_|_|\___/|_| |_| // */
/* // // */
/* //////////////////////////////////////////////////////////// */
Response: "{\"IsTor\":true,\"IP\":\"91.219.239.166\"}"
Contributions are what make the open-source community such a fantastic place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Distributed under the MIT License. See LICENSE
for more information.
Join us in our journey to make the internet a safer, more private space for everyone. Happy coding! 🎉