Module tor

Module tor 

Source
Expand description

Tor Integration for Privacy-Preserving Networking

This module provides integration with the Tor network for anonymous and privacy-preserving peer-to-peer communication. It supports both client connections through Tor and hosting hidden services for anonymous server endpoints.

§Features

  • SOCKS5 Proxy: Connect to peers through Tor’s SOCKS5 proxy
  • Onion Routing: Multi-hop encrypted routing for anonymity
  • Hidden Services: Host anonymous .onion endpoints
  • Circuit Management: Control Tor circuits for optimal performance
  • Stream Isolation: Separate streams for different applications
  • Bandwidth Management: Throttle Tor traffic to avoid network congestion

§Use Cases

  • Privacy: Hide IP addresses from peers and network observers
  • Censorship Resistance: Access content in restrictive networks
  • Anonymous Publishing: Host content without revealing location
  • Surveillance Protection: Protect against traffic analysis

§Example

use ipfrs_network::tor::{TorManager, TorConfig, HiddenServiceConfig};

// Create Tor manager
let config = TorConfig::default();
let mut manager = TorManager::new(config).await?;

// Start Tor
manager.start().await?;

// Connect through Tor
let peer_addr = "example.onion:8080";
let stream = manager.connect(peer_addr).await?;

// Create hidden service
let hs_config = HiddenServiceConfig::default();
let onion_addr = manager.create_hidden_service(hs_config).await?;
println!("Hidden service available at: {}", onion_addr);

Structs§

CircuitInfo
Information about a Tor circuit
HiddenServiceConfig
Hidden service configuration
TorConfig
Configuration for Tor manager
TorManager
Tor network manager
TorStats
Statistics for Tor operations

Enums§

CircuitState
Tor circuit state
TorError
Errors that can occur in Tor operations

Type Aliases§

CircuitId
Tor circuit identifier
OnionAddress
Onion address (e.g., “example.onion”)
Result
Result type for Tor operations
StreamId
Stream identifier