Zapret : Enable autolist & new params.

This commit is contained in:
Dmitry Voronin 2024-09-02 13:03:19 +03:00
parent 0b5bddca2a
commit 88bed3b96a
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 16 additions and 3 deletions

View file

@ -1,4 +1,4 @@
{ ... }: { { config, ... }: {
imports = [ imports = [
./Backup.nix ./Backup.nix
./Container.nix ./Container.nix
@ -33,7 +33,8 @@
}; };
zapret = { zapret = {
enable = true; enable = true;
params = "--dpi-desync=fake,split2 --dpi-desync-fooling=datanoack"; params = "--dpi-desync=fake,disorder2 --dpi-desync-ttl=1 --dpi-desync-autottl=2";
autolist = "${config.container.module.frkn.storage}/Autolist.txt";
whitelist = '' whitelist = ''
youtube.com youtube.com
googlevideo.com googlevideo.com
@ -43,6 +44,9 @@
rutracker.cc rutracker.cc
rutrk.org rutrk.org
t-ru.org t-ru.org
medium.com
quora.com
quoracdn.net
''; '';
}; };
}; };

View file

@ -9,6 +9,11 @@
blacklist = if cfg.blacklist != null then blacklist = if cfg.blacklist != null then
"--hostlist-exclude ${pkgs.writeText "ZapretBlacklist" (util.trimTabs cfg.blacklist)}" "--hostlist-exclude ${pkgs.writeText "ZapretBlacklist" (util.trimTabs cfg.blacklist)}"
else ""; else "";
# ISSUE: Seems broken. Adds nothing automatically.
autolist = if cfg.autolist != null then
"--hostlist-auto ${cfg.autolist}"
else "";
in { in {
options = { options = {
module.zapret = mkOption { module.zapret = mkOption {
@ -28,6 +33,10 @@ in {
default = null; default = null;
type = types.nullOr types.str; type = types.nullOr types.str;
}; };
autolist = mkOption {
default = null;
type = types.nullOr types.str;
};
qnum = mkOption { qnum = mkOption {
default = 200; default = 200;
type = types.int; type = types.int;
@ -49,7 +58,7 @@ in {
requires = [ "network.target" ]; requires = [ "network.target" ];
path = with pkgs; [ zapret ]; path = with pkgs; [ zapret ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.zapret}/bin/nfqws --pidfile=/run/nfqws.pid ${cfg.params} ${whitelist} ${blacklist} --qnum=${toString cfg.qnum}"; ExecStart = "${pkgs.zapret}/bin/nfqws --pidfile=/run/nfqws.pid ${cfg.params} ${whitelist} ${blacklist} ${autolist} --qnum=${toString cfg.qnum}";
Type = "simple"; Type = "simple";
PIDFile = "/run/nfqws.pid"; PIDFile = "/run/nfqws.pid";
ExecReload = "/bin/kill -HUP $MAINPID"; ExecReload = "/bin/kill -HUP $MAINPID";