How nstrmx/goodbye-dpi works
Project Type and Purpose
• Type: A cross-platform, CLI-based proxy server / DPI-circumvention utility written in Rust.
• Purpose: Listen on a local TCP port, intercept HTTP(S) traffic from a browser, fragment the first TCP packet of each flow according to host‐based blacklists (Aho-Corasick), resolve DNS via configurable external providers, and forward each connection to the appropriate upstream proxy.
File Structure
• src/main.rs: entry point, orchestrates startup, configuration loading, listener setup.
• src/config.rs: parses YAML configuration (buffer sizes, proxy servers, blacklists, DNS settings).
• src/dns.rs: implements DNS resolution using Cloudflare, Google, Quad9 over TLS/HTTPS/TCP/UDP.
• src/client.rs: handles individual client connections, implements TCP fragmentation logic and proxy routing.
• default_blacklist, tor_blacklist, youtube_blacklist: text files loaded at runtime by the blacklist engine.
• config.yaml: example runtime configuration.
README for Architecture Insights
• Core algorithms: Aho-Corasick for pattern matching in blacklists, TCP-level fragmentation to evade DPI.
• External interactions: DNS providers (DoT, DoH), upstream proxy servers (e.g., TCP 127.0.0.1:8080, SOCKS5 127.0.0.1:9050).
Main Components
a. Internal Modules (Rectangles):
• Orchestrator / CLI (main.rs)
• Configuration Loader (config.rs)
• Blacklist Engine (Aho-Corasick)
• DNS Resolver (dns.rs)
• TCP Listener & Connection Handler (client.rs)
• Fragmentation Processor (first‐packet splitter)
• Proxy Router / Dispatcher
b. External Systems (Ovals):
• Browser (HTTP/S client)
• DNS Providers (Cloudflare, Google, Quad9)
• Upstream Proxy Servers (default TCP proxy, Tor SOCKS5, others)
• Blacklist Files (default_blacklist, tor_blacklist, …)
• YAML Config File (config.yaml)
Relationships & Data Flow
1. Browser → TCP Listener (127.0.0.1:8080)
2. Listener passes raw stream to Connection Handler
3. Handler invokes Fragmentation Processor on first packet
4. Connection Handler performs a DNS lookup via DNS Resolver
5. Resolver → External DNS Provider → Resolver returns IP
6. Handler queries Blacklist Engine with hostname to pick target proxy
7. Proxy Router → selected Upstream Proxy
8. Upstream Proxy ↔ External network → responses back along same path
9. Handler re-assembles fragments if needed and writes back to Browser
Architectural Patterns & Design Principles
• Modular Monolith: clear separation of concerns by module.
• Plugin-style Blacklists: plain text files drive host matching logic.
• Single entry point with pluggable subsystems (DNS, fragmentation, proxy routing).
• Asynchronous I/O (if implemented with Tokio or similar)—highlight if using async runtimes.
Relevant Technologies & Libraries
• Rust toolchain (Cargo, rustc)
• Aho-Corasick crate for multi‐pattern matching
• serde / serde_yaml for config parsing
• tokio or std::net for networking
• YAML for configuration
• External DNS protocols: DoH, DoT, UDP/TCP
• Are all internal components labeled and placed within a “Goodbye-DPI” boundary?
• Are external actors (Browser, DNS, Proxy Servers) clearly outside that boundary?