aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opt.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move platform-dependant codes to mod platformdilluti0n2026-07-081-17/+3
|
* opt: nit refinedilluti0n2026-07-081-14/+14
|
* opt: fix help messagesdilluti0n2026-06-291-15/+14
|
* windows: wait for keypress before exit on --helpdilluti0n2026-04-161-1/+16
| | | | | | UAC elevation spawns a new console that closes when the process exits, cutting off --help output and error messages. Add a pause on Windows-only exit paths via _getch().
* opt: fix -D deprecation warning conditiondilluti0n2026-04-051-1/+1
| | | | | Previously checked `argv == "--loglevel"` by mistake, copied from the --loglevel deprecation pattern. Now correctly checks `argv == "-D"`.
* Add shopt -t, -a for --fake-ttl, --fake-autottl, respectivelydilluti0n2026-04-051-7/+7
|
* Add short option -d for --daemon, deprecating -D.dilluti0n2026-04-051-3/+9
|
* opt: add shopt for --segment-order and descriptiondilluti0n2026-04-051-2/+3
|
* pkt: implement segment-order aware send_splitdilluti0n2026-04-051-12/+24
| | | | | | Replace hardcoded [0,1] split with send_split accepting &[Segment]. Segments exceeding payload length are warned and skipped. Add Segment type to opt.rs with Display/Debug showing [start,end) notation.
* opt: implement SegmentOrder::new and Displaydilluti0n2026-04-051-4/+49
| | | | | | Parse comma-separated split points into sorted segment ranges as (start, end): pairs. Display shows original input with computed ranges, e.g. "5,1,0,3 ([5,end), [1,3), [0,1), [3,5))".
* opt: add SegmentOrder type and --segment-order optiondilluti0n2026-04-051-13/+47
| | | | | | | SegmentOrder parses a comma-separated list of u32 split points, sorts them, and precomputes segment ranges as (start, end) pairs for use in send_split. The original input string is retained for Display. Parsing logic is unimplemented and will follow in the next commit.
* log: add debug!/info!/warn!/error! macros and refactor to use itdilluti0n2026-03-021-12/+10
|
* 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