summaryrefslogtreecommitdiffhomepage
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* linux: drop iptables crate (regex dep) to reduce binary sizedilluti0n2026-01-181-23/+75
| | | | Introduce minimal iptables wrapper.
* opt: change default release log level to Warning as expecteddilluti0n2026-01-161-1/+1
|
* pkt: add debug_assertions to prevent cargo warningsdilluti0n2026-01-161-1/+3
|
* opt: deprecate `--loglevel` in favor of `--log-level`dilluti0n2026-01-161-3/+13
|
* opt: set default opts to DEFAULT_* to centralize init & usage outputdilluti0n2026-01-161-36/+46
|
* opt: use DEFAULT_LOG_LEVEL in arg parserdilluti0n2026-01-161-4/+1
| | | | | Initialize log_level from DEFAULT_LOG_LEVEL instead of duplicated cfg(debug_assertions) branches in parse_args_1().
* opt: fix OPT_LOG_LEVEL not initialized panicdilluti0n2026-01-161-2/+4
|
* opt: add comment for OPT_LOG_LEVEL initialize seqdilluti0n2026-01-161-0/+1
|
* Refactor main.rs; modulize opt.rs and pkt.rsdilluti0n2026-01-165-269/+283
| | | | | Move option parsing to opt.rs and packet handling to pkt.rs from main.rs
* pkt: support overriding TCP checksum (badsum) in split_packet_0dilluti0n2026-01-162-12/+38
| | | | | | - Extend split_packet_0 to optionally override TCP checksum. - Compute L3 header length for IPv4/IPv6 and patch checksum field when requested. - Wire fake_clienthello to set checksum to 0 when fake_badsum() is enabled.
* windows: do not recalculate tcp checksum when send_to_rawdilluti0n2026-01-161-3/+3
| | | | For --fake-badsum work; Anyway, it is already calculated
* Add option --fake-badsumdilluti0n2026-01-142-0/+9
|
* Fix option --fake did not do anythingdilluti0n2026-01-051-2/+8
| | | | Fake was enabled by default.....
* Normalize option handling and OPT_* namingdilluti0n2025-12-302-16/+27
| | | | Log runtime options on startup
* Add fake ClientHello injection runtime optionsdilluti0n2025-12-302-3/+20
| | | | | - Add --fake flag to enable fake ClientHello injection - Add --fake-ttl option to override TTL of fake packets
* Consolidate fake ClientHello and split packet logicdilluti0n2025-12-302-35/+44
| | | | Introduce send_segment abstraction
* Prevent infinite loop on packet injection/filteringdilluti0n2025-12-303-6/+43
| | | | | - linux: fix infinite NFQUEUE loop by marking injected packets - windows: by marking packet to impostor
* Implement fake ClientHello injection with const TTLdilluti0n2025-12-302-42/+83
|
* Add dummy tls clienthello packetdilluti0n2025-12-301-0/+63
|
* linux: extract process execution into `exec_process` helperdilluti0n2025-12-291-17/+29
| | | | | | | | Introduce exec_process() to handle external command execution, stdin piping, and error reporting. Now cleanup() and apply_nft_rules() call exec_process() to call modprobe, nft respectively. This improves error handling for cleanup xt_u32.
* linux: ignore cleanup errors at startupdilluti0n2025-12-221-7/+3
| | | | | Do not log errors if cleanup fails during startup. Retain error logging for cleanup failures on shutdown.
* linux: switch to apply_nft_rules() from nftables-rs for rule settingdilluti0n2025-10-291-18/+13
| | | | | nftables-rs didn’t fit use case, so it was decoupled, and logging was improved.
* linux: implement apply_nft_rules() to log output sanelydilluti0n2025-10-291-0/+30
|
* linux: add option `--nft-command`dilluti0n2025-10-292-10/+23
|
* windows: avoid ERR_INVALID_NAME when uninstalling WinDivertdilluti0n2025-10-061-2/+9
| | | | | | | `CloseAction::Uninstall` triggers ERROR_INVALID_NAME (0x8007007B) on Windows, likely due to the crate passing a non–NUL-terminated "WinDivert" string to `OpenServiceA`. For now, skip uninstallation and just close the handle normally. Added a FIXME comment with details.
* platform: windows: close handle and uninstall driver sanelydilluti0n2025-10-061-9/+19
|
* platform: windows: only divert clienthello packet to userspacedilluti0n2025-10-032-2/+4
|
* platform: linux: filter only TLS ClientHello packets on nftablesdilluti0n2025-10-031-0/+21
| | | | | | | | Add additional nftables match expressions to detect TLS records (ContentType 0x16 = Handshake): and specifically ClientHello (HandshakeType 0x01):. Packets matching this pattern are queued to NFQUEUE. Mark xt_u32 as supported when nftables filtering is successfully applied.
* platform: linux: add nftables support with iptables fallbackdilluti0n2025-10-031-11/+112
| | | | | | | | | | Introduce nftables rules under a dedicated "dpibreak" table and chain. Traffic on TCP port 443 is queued using NFQUEUE. If nftables is not supported, fall back to the existing iptables-based rules for both IPv4 and IPv6. Also update cleanup logic to remove nftables table if used, or iptables rules otherwise.
* platform: linux: split iptables helpers on bootstrap/cleanupdilluti0n2025-09-271-14/+25
|
* Refactor packet sending into split_packet_1 helperdilluti0n2025-09-151-9/+24
| | | | | | | * Extracted: repeated split/send/sleep logic from `handle_packet` into new `split_packet_1` function for clarity and reuse. * Simplifies: `handle_packet` by replacing manual steps with a single call.
* Refactor handle_packet to reuse external buffer for packet handlingdilluti0n2025-09-114-9/+16
| | | | This removes unnecessary allocations per packet handling.
* log: add splash! macro and centralize no-splash handlingdilluti0n2025-09-074-30/+39
| | | | | | | | | | | | | * Introduce: `splash!` macro in `log.rs` to print startup messages conditionally, based on `--no-splash` flag. * Move: `NO_SPLASH` management into `log.rs` with helper functions: (`set_no_splash`, `no_splash`). * Remove: old `splash()` function in `main.rs` and replace with `splash!` macro usage. * Set: default `LogLevel` according to build profile (Debug → Debug, Release → Warning). * Print: unified startup messages across Linux and Windows, including `MESSAGE_AT_RUN`.
* Update copyright notices to notice email instead of github linkdilluti0n2025-09-057-7/+7
|
* main: fix typo on splash message.dilluti0n2025-09-051-1/+1
|
* Update version and metadatas on Cargo.tomldilluti0n2025-09-051-2/+7
| | | | * Use: Cargo.toml inside on program
* Add license document and copyright notice headersdilluti0n2025-09-057-0/+119
|
* Add help message for flag --no-splashdilluti0n2025-09-051-0/+1
|
* log: update error messagedilluti0n2025-09-051-1/+1
|
* Add splash message and option --no-splashdilluti0n2025-09-051-1/+18
|
* Add flag --loglevel to set loglevel on runtimedilluti0n2025-09-032-10/+51
| | | | | | | | | | | | | | | * Introduce: `DEFAULT_LOG_LEVEL` and `LOG_LEVEL_OVERRIDE` (OnceLock) in log.rs. * Add: `set_log_level()` and `current_log_level()`; gate defaults by `debug_assertions`. * Implement: `FromStr` for `LogLevel` with a proper error type (`ParseLogLevelError`). * Update: `log_println!` to respect `current_log_level()` and use `format_args!`. * Extend: CLI: `--loglevel <debug|info|warning|error>` and reflect it in `usage()`. * Replace: ad-hoc prints with `log_println!` and plumb parsed level into `set_log_level`.
* Tidy up LogLevel enum definitiondilluti0n2025-09-034-21/+21
| | | | | | * Remove: unused `Fatal` variant from `LogLevel`. * Update: comment on `Error` to indicate it represents unrecoverable errors.
* Use log.rs for conditional logging and centralized error reportingdilluti0n2025-09-032-3/+8
| | | | | | | | | * Set: `LOG_LEVEL` to `Debug` in debug builds and `Warning` in release builds via `#[cfg(debug_assertions)]`. * Replace: direct `println!` calls with `log_println!` for packet handling, warning messages, and argument parsing errors. * Ensures: consistent log formatting and respects the global log level configuration across the codebase.
* Refactor main to ensure cleanup via RAII guarddilluti0n2025-09-031-2/+31
| | | | | | | | | Introduce `EnsureCleanup` struct with a `Drop` implementation that calls `platform::cleanup()`. This guarantees cleanup is always performed after a successful bootstrap, regardless of how execution exits. Error handling is centralized in `main()`, where errors are logged once with their cause chain, and the process exits with the appropriate status code.
* Refactor prefixed logs to using log.rs, leaving Errors untoucheddilluti0n2025-09-033-10/+13
|
* Implement log.rs; log level handlingdilluti0n2025-09-031-0/+34
|
* Add prefix [INFO] or [WARNNING] on log messagesdilluti0n2025-08-312-10/+10
|
* platform: windows: log WinDivert handle creationdilluti0n2025-08-311-5/+7
| | | | | | Define the TCP:443 outbound filter as a constant and reuse it in WinDivert::network. Add a log message when the handle is successfully constructed for better visibility during runtime.
* platform: linux: add verbose messages on bootstrapdilluti0n2025-08-311-3/+19
|
* platform: linux: unhardcode chain name DPIBREAKdilluti0n2025-08-311-7/+11
|