diff --git a/modules/darwin.nix b/modules/darwin.nix index d49ee3b..f0df0d2 100644 --- a/modules/darwin.nix +++ b/modules/darwin.nix @@ -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; diff --git a/modules/nixos.nix b/modules/nixos.nix index 026afc9..498e176 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -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"; }; }; diff --git a/modules/options.nix b/modules/options.nix index 60b7ddc..38d7798 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -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;