diff --git a/home/program/bash/module/Zapret.nix b/home/program/bash/module/Zapret.nix index 2d60476..ee6564f 100644 --- a/home/program/bash/module/Zapret.nix +++ b/home/program/bash/module/Zapret.nix @@ -1,9 +1,10 @@ -{ config, ... }: { +{ ... }: { text = '' # FRKN. + # SOURCE: https://github.com/bol-van/zapret function zapret() { iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass - nfqws --pidfile=/run/nfqws.pid ${config.module.zapret.params} --qnum=200 + nfqws --pidfile=/run/nfqws.pid --qnum=201 ''${@} } ''; } diff --git a/host/x86_64-linux/home/default.nix b/host/x86_64-linux/home/default.nix index 06360db..a8fd6b3 100644 --- a/host/x86_64-linux/home/default.nix +++ b/host/x86_64-linux/home/default.nix @@ -33,6 +33,7 @@ }; zapret = { enable = true; + params = "--dpi-desync=fake,split2 --dpi-desync-fooling=datanoack"; whitelist = '' youtube.com googlevideo.com diff --git a/module/Zapret.nix b/module/Zapret.nix index 6396a5f..8524e4c 100644 --- a/module/Zapret.nix +++ b/module/Zapret.nix @@ -17,7 +17,7 @@ in { options = { enable = mkEnableOption "Enable Zapret service."; params = mkOption { - default = "--dpi-desync=fake,split2 --dpi-desync-fooling=datanoack"; + default = null; type = types.str; }; whitelist = mkOption { @@ -28,6 +28,10 @@ in { default = null; type = types.nullOr types.str; }; + qnum = mkOption { + default = 200; + type = types.int; + }; }; }; }; @@ -35,7 +39,7 @@ in { config = mkIf cfg.enable { networking.firewall.extraCommands = '' - iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass + iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${toString cfg.qnum} --queue-bypass ''; systemd = { @@ -45,7 +49,7 @@ in { requires = [ "network.target" ]; path = with pkgs; [ zapret ]; serviceConfig = { - ExecStart = "${pkgs.zapret}/bin/nfqws --pidfile=/run/nfqws.pid ${cfg.params} ${whitelist} ${blacklist} --qnum=200"; + ExecStart = "${pkgs.zapret}/bin/nfqws --pidfile=/run/nfqws.pid ${cfg.params} ${whitelist} ${blacklist} --qnum=${toString cfg.qnum}"; Type = "simple"; PIDFile = "/run/nfqws.pid"; ExecReload = "/bin/kill -HUP $MAINPID";