summaryrefslogtreecommitdiffhomepage
path: root/src/platform/windows.rs
Commit message (Collapse)AuthorAgeFilesLines
* windows: fix regression intorduced in b68753e8dilluti0n2026-02-161-5/+2
|
* windows: fix nit build failurev0.4.2dilluti0n2026-02-161-3/+3
|
* opt: decouple set_opt() from loggingdilluti0n2026-02-161-3/+7
| | | | | | | | | | | | | | | | | | | | | | set_opt() was logging each option as it set them, which created a tight coupling between option initialization and log output timing. This was particularly problematic for daemon mode: daemonize must happen after set_opt() (to know whether -D was passed) but before logging (so output goes to the log file, not stdout). Split into set_opt() -> InitializedOpts and InitializedOpts::log(), using a typestate pattern to enforce at compile time that log() cannot be called before set_opt(). This lets each platform's bootstrap() handle daemonization between the two steps: let initialized = opt.set_opt()?; platform::bootstrap()?; // daemonize here if needed initialized.log(); // now safe to log Also: - Move daemonize_1() into platform::bootstrap() on both platforms - Make daemonize_1() / service_main() private to their platform modules - Fix the long-standing TODO about using log_println in daemonize()
* opt: refactor to detach parse_args and set_optdilluti0n2026-02-151-1/+2
|
* windows: implement windows servicedilluti0n2026-02-151-3/+42
| | | | | | | | | Revert lock_handle() send_to_raw cannot get a mutex since lock is not released per iteration. commit e08b57d281d8368dc02f06e3b6cd43edf88b2438
* linux: implement daemonizedilluti0n2026-02-151-0/+4
| | | | | Closes: #2 Link: https://github.com/dilluti0n/dpibreak/issues/2
* windows: extend WinDivert filter for --fake-autottldilluti0n2026-01-231-6/+18
| | | | | | | Build WinDivert filter at runtime: - Default: outbound TLS ClientHello packets - --fake-autottl: also capture inbound SYN/ACK from tcp sport 443 Keep !impostor to avoid recapture.
* windows: do not recalculate tcp checksum when send_to_rawdilluti0n2026-01-161-3/+3
| | | | For --fake-badsum work; Anyway, it is already calculated
* Prevent infinite loop on packet injection/filteringdilluti0n2025-12-301-1/+3
| | | | | - linux: fix infinite NFQUEUE loop by marking injected packets - windows: by marking packet to impostor
* 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-031-1/+3
|
* Refactor handle_packet to reuse external buffer for packet handlingdilluti0n2025-09-111-2/+5
| | | | This removes unnecessary allocations per packet handling.
* log: add splash! macro and centralize no-splash handlingdilluti0n2025-09-071-2/+4
| | | | | | | | | | | | | * 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-051-1/+1
|
* Add license document and copyright notice headersdilluti0n2025-09-051-0/+17
|
* Tidy up LogLevel enum definitiondilluti0n2025-09-031-2/+2
| | | | | | * Remove: unused `Fatal` variant from `LogLevel`. * Update: comment on `Error` to indicate it represents unrecoverable errors.
* Refactor prefixed logs to using log.rs, leaving Errors untoucheddilluti0n2025-09-031-1/+2
|
* Add prefix [INFO] or [WARNNING] on log messagesdilluti0n2025-08-311-1/+1
|
* 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.
* Decouple once_cell by replacing it with standard libDilluti0n2025-08-231-3/+2
|
* Simplify signal handling with global AtomicBoolDilluti0n2025-08-231-6/+4
| | | | | | | * Remove Arc<AtomicBool> indirection and introduce global RUNNING. * Rename plant_handler() to trap_exit() for clarity. * Update run() implementations on Linux and Windows to use RUNNING directly. * Drop unused imports in main.rs, linux.rs, and windows.rs.
* Wrap platform dependant main loops to platform::runhskim2025-08-221-0/+21
|
* refactor: add error propagation to send_to_rawdilluti0n2025-08-061-2/+4
| | | | | | | * Extracted: `handle_packet!` macro to deduplicate match logic in both Linux and Windows backend. * Changed: `send_to_raw()` to return Result and propagate errors with `anyhow!`.
* refactor: Unified all error types in the project to anyhow::Errordilluti0n2025-08-061-3/+3
| | | | | | | | Configured incompatible iptables errors to be propagated using map_err into the anyhow type * refactored: split_packet and handle_packet to return Result<> instead of Option<>
* minor: remove handle_msg rapperdilluti0n2025-08-061-4/+5
| | | | | | | modify to have a simmilar flow with windows build * change ordering * debug messages
* minor: move platform-specific codes to seperate filesdilluti0n2025-08-061-0/+38