feat: allow setting zapret configs per default domains and default configs
This commit is contained in:
8 files changed
+710
-59
No files matched your search
@@ -1184,6 +1184,32 @@ let
|
||||
nfqwsArgs = [ "--filter-udp=443 --dpi-desync=fake --dpi-desync-repeats=6" ];
|
||||
enableDirectSync = false;
|
||||
}
|
||||
{
|
||||
name = "youtube-general";
|
||||
defaultDomains = [ "youtube" ];
|
||||
configName = "general";
|
||||
}
|
||||
{
|
||||
name = "discord-alt12";
|
||||
defaultDomains = [ "discord" ];
|
||||
configName = "general (ALT12)";
|
||||
}
|
||||
{
|
||||
name = "other";
|
||||
defaultDomains = [ "other" ];
|
||||
preset = "general";
|
||||
}
|
||||
{
|
||||
name = "upstream-ips";
|
||||
defaultIps = [ "all" ];
|
||||
configName = "general";
|
||||
enableDirectSync = false;
|
||||
}
|
||||
{
|
||||
name = "explicit-ips";
|
||||
ips = [ "203.0.113.0/24" ];
|
||||
configName = "general";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1240,6 +1266,37 @@ let
|
||||
}
|
||||
];
|
||||
|
||||
conflictingZapretHostlistConfigAndArgs = mkBadFixture [
|
||||
{
|
||||
services.proxy-suite.zapret = {
|
||||
enable = true;
|
||||
hostlistRules = [
|
||||
{
|
||||
name = "conflict";
|
||||
defaultDomains = [ "youtube" ];
|
||||
configName = "general";
|
||||
nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
configNameZapretHostlistWithoutFamily = mkBadFixture [
|
||||
{
|
||||
services.proxy-suite.zapret = {
|
||||
enable = true;
|
||||
hostlistRules = [
|
||||
{
|
||||
name = "missing-family";
|
||||
domains = [ "example.com" ];
|
||||
configName = "general";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
proxyDirectFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
@@ -2548,6 +2605,14 @@ let
|
||||
assert missingZapretHostlistAction.success == false;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert conflictingZapretHostlistConfigAndArgs.success == false;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert configNameZapretHostlistWithoutFamily.success == false;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert tproxyWithFirewall.config.networking.firewall.enable;
|
||||
true
|
||||
@@ -2784,6 +2849,17 @@ let
|
||||
assert !(hasDirectDomain zapretHostlistRules "x.example");
|
||||
true
|
||||
)
|
||||
(
|
||||
assert hasDirectDomain zapretHostlistRules "youtube.com";
|
||||
assert hasDirectDomain zapretHostlistRules "discord.com";
|
||||
assert hasDirectDomain zapretHostlistRules "cloudflare-ech.com";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert hasDirectIP zapretHostlistRules "203.0.113.0/24";
|
||||
assert !(hasDirectIP zapretHostlistRules "1.1.1.0/24");
|
||||
true
|
||||
)
|
||||
(
|
||||
assert hasRuleSet blockGeoRules "block" "geosite-category-ads-all";
|
||||
true
|
||||
@@ -3564,6 +3640,19 @@ in
|
||||
grep -F -- '--hostlist="${zapretHostlistBase}/hostlists/list-googlevideo.txt"' "${zapretHostlistBase}/config"
|
||||
grep -F -- '--hostlist="${zapretHostlistBase}/hostlists/list-example.txt"' "${zapretHostlistBase}/config"
|
||||
grep -F -- '--filter-tcp=443 --dpi-desync=fake,multisplit --hostlist="${zapretHostlistBase}/hostlists/list-example.txt" --hostlist-exclude="${zapretHostlistBase}/hostlists/list-exclude.txt" --hostlist-exclude="${zapretHostlistBase}/hostlists/list-exclude-user.txt" --ipset-exclude="${zapretHostlistBase}/hostlists/ipset-exclude.txt" --ipset-exclude="${zapretHostlistBase}/hostlists/ipset-exclude-user.txt" --new' "${zapretHostlistBase}/config"
|
||||
grep -F 'youtube.com' "${zapretHostlistBase}/hostlists/list-youtube-general.txt"
|
||||
grep -F 'googlevideo.com' "${zapretHostlistBase}/hostlists/list-youtube-general.txt"
|
||||
grep -F 'discord.com' "${zapretHostlistBase}/hostlists/list-discord-alt12.txt"
|
||||
grep -F 'discord.gg' "${zapretHostlistBase}/hostlists/list-discord-alt12.txt"
|
||||
! grep -F 'cloudflare-ech.com' "${zapretHostlistBase}/hostlists/list-discord-alt12.txt"
|
||||
grep -F 'cloudflare-ech.com' "${zapretHostlistBase}/hostlists/list-other.txt"
|
||||
! grep -F 'discord.com' "${zapretHostlistBase}/hostlists/list-other.txt"
|
||||
grep -F '1.1.1.0/24' "${zapretHostlistBase}/hostlists/ipset-upstream-ips.txt"
|
||||
grep -F '203.0.113.0/24' "${zapretHostlistBase}/hostlists/ipset-explicit-ips.txt"
|
||||
grep -F -- '--hostlist="${zapretHostlistBase}/hostlists/list-youtube-general.txt"' "${zapretHostlistBase}/config"
|
||||
grep -F -- '--dpi-desync=multisplit --dpi-desync-split-seqovl=681' "${zapretHostlistBase}/config"
|
||||
grep -F -- '--ipset="${zapretHostlistBase}/hostlists/ipset-upstream-ips.txt"' "${zapretHostlistBase}/config"
|
||||
grep -F -- '--ipset="${zapretHostlistBase}/hostlists/ipset-explicit-ips.txt"' "${zapretHostlistBase}/config"
|
||||
touch "$out"
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user