summaryrefslogtreecommitdiffhomepage
path: root/src/opt.rs
Commit message (Collapse)AuthorAgeFilesLines
* opt: decouple set_opt() from loggingdilluti0n2026-02-161-7/+22
| | | | | | | | | | | | | | | | | | | | | | 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()
* Consolidate setup logic into run()dilluti0n2026-02-151-0/+6
| | | | | | | | | | | The bootstrap/run separation was unnecessary. Move all initialization (cleanup + nftables setup): into run() and skip bootstrap in daemon mode. We repurpose the bootstrap() function to only run in non-daemon mode for future foreground-only initialization. - Add OPT_DAEMON option to detect daemon mode - Move cleanup() and install_rules() from bootstrap() to run() - Make bootstrap() a no-op (only called in non-daemon mode)
* opt: refactor to detach parse_args and set_optdilluti0n2026-02-151-86/+105
|
* linux: implement daemonizedilluti0n2026-02-151-10/+5
| | | | | Closes: #2 Link: https://github.com/dilluti0n/dpibreak/issues/2
* opt: add option -D, --daemondilluti0n2026-02-141-0/+18
|
* opt: add implicit dependancy between --fake-* and --fakedilluti0n2026-01-311-3/+3
| | | | Now --fake-* options implicitly turn on --fake option.
* opt: add option --fake-autottldilluti0n2026-01-231-7/+18
|
* opt: change default release log level to Warning as expecteddilluti0n2026-01-161-1/+1
|
* 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-161-0/+165
Move option parsing to opt.rs and packet handling to pkt.rs from main.rs