feat(modules): expose min-chunk, max-chunk, delay-us, extraArgs as Nix options

Allows tuning fragmentation parameters for performance.
Defaults match CLI defaults (min 3, max 8, delay 500us).
This commit is contained in:
Kreato 2026-06-01 22:27:50 +03:00
parent 50521e8dbd
commit 02f9817e57
No known key found for this signature in database
3 changed files with 30 additions and 4 deletions

View file

@ -12,9 +12,10 @@ in
config = lib.mkIf cfg.enable {
launchd.user.agents.ihtc = {
command = "${self.packages.${system}.ihtc}/bin/ihtc --listen 127.0.0.1:${toString cfg.port} --refrag ${toString cfg.refrag} --auto-proxy"
command = "${self.packages.${system}.ihtc}/bin/ihtc --listen 127.0.0.1:${toString cfg.port} --min-chunk ${toString cfg.minChunk} --max-chunk ${toString cfg.maxChunk} --delay-us ${toString cfg.delayUs} --refrag ${toString cfg.refrag} --auto-proxy"
+ lib.optionalString cfg.verbose " --verbose"
+ lib.optionalString (cfg.patterns != [ ]) " --regex '${regex}'";
+ lib.optionalString (cfg.patterns != [ ]) " --regex '${regex}'"
+ lib.optionalString (cfg.extraArgs != [ ]) " ${builtins.concatStringsSep " " cfg.extraArgs}";
serviceConfig = {
RunAtLoad = true;
KeepAlive = true;

View file

@ -15,9 +15,10 @@ in
description = "ihtc DPI bypass proxy";
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${self.packages.${system}.ihtc}/bin/ihtc --listen 127.0.0.1:${toString cfg.port} --refrag ${toString cfg.refrag}"
ExecStart = "${self.packages.${system}.ihtc}/bin/ihtc --listen 127.0.0.1:${toString cfg.port} --min-chunk ${toString cfg.minChunk} --max-chunk ${toString cfg.maxChunk} --delay-us ${toString cfg.delayUs} --refrag ${toString cfg.refrag}"
+ lib.optionalString cfg.verbose " --verbose"
+ lib.optionalString (cfg.patterns != [ ]) " --regex '${regex}'";
+ lib.optionalString (cfg.patterns != [ ]) " --regex '${regex}'"
+ lib.optionalString (cfg.extraArgs != [ ]) " ${builtins.concatStringsSep " " cfg.extraArgs}";
Restart = "always";
};
};

View file

@ -23,6 +23,30 @@ in
description = "Minimum chunk count for ClientHello (0 = disabled)";
};
minChunk = mkOption {
type = types.int;
default = 3;
description = "Minimum bytes per fragment";
};
maxChunk = mkOption {
type = types.int;
default = 8;
description = "Maximum bytes per fragment";
};
delayUs = mkOption {
type = types.int;
default = 500;
description = "Max microsecond delay between fragments (0 to disable)";
};
extraArgs = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Extra CLI arguments passed to ihtc";
};
verbose = mkOption {
type = types.bool;
default = false;