make includeExtraUpstreamLists opt-in
This commit is contained in:
4 files changed
+27
-8
No files matched your search
@@ -270,11 +270,11 @@ zapret = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
When `syncDirectRouting = true`, the module always reuses zapret's upstream `hostlists/list-general.txt` and `list-google.txt`, adds your `listGeneral`, and subtracts both upstream and user domain exclusions before generating sing-box direct rules. If `zapret.includeExtraUpstreamLists = true` (default), it also includes upstream `list-instagram.txt`, `list-soundcloud.txt`, and `list-twitter.txt` in both zapret handling and sing-box direct sync.
|
When `syncDirectRouting = true`, the module always reuses zapret's upstream `hostlists/list-general.txt` and `list-google.txt`, adds your `listGeneral`, and subtracts both upstream and user domain exclusions before generating sing-box direct rules. If `zapret.includeExtraUpstreamLists = true`, it also includes upstream `list-instagram.txt`, `list-soundcloud.txt`, and `list-twitter.txt` in both zapret handling and sing-box direct sync.
|
||||||
|
|
||||||
Custom `zapret.hostlistRules` domains also join this direct-domain sync by default. Set `enableDirectSync = false` on a custom hostlist if you want zapret to handle it but do not want sing-box direct-routing rules generated from it.
|
Custom `zapret.hostlistRules` domains also join this direct-domain sync by default. Set `enableDirectSync = false` on a custom hostlist if you want zapret to handle it but do not want sing-box direct-routing rules generated from it.
|
||||||
|
|
||||||
The generated zapret config also auto-activates upstream `list-instagram.txt`, `list-soundcloud.txt`, and `list-twitter.txt` when the selected upstream preset does not already reference them. They are attached using the active config's `general` rule family so those hostlists are actually handled by zapret instead of just existing on disk. Set `zapret.includeExtraUpstreamLists = false;` to opt out.
|
The generated zapret config can also auto-activate upstream `list-instagram.txt`, `list-soundcloud.txt`, and `list-twitter.txt` when the selected upstream preset does not already reference them. They are attached using the active config's `general` rule family so those hostlists are actually handled by zapret instead of just existing on disk. This is disabled by default; set `zapret.includeExtraUpstreamLists = true;` to opt in.
|
||||||
|
|
||||||
When `syncDirectRoutingUpstreamIps = true`, the module also mirrors zapret's upstream `ipset-all.txt`. This is disabled by default because the upstream IP set is intentionally broad.
|
When `syncDirectRoutingUpstreamIps = true`, the module also mirrors zapret's upstream `ipset-all.txt`. This is disabled by default because the upstream IP set is intentionally broad.
|
||||||
|
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ in
|
|||||||
|
|
||||||
includeExtraUpstreamLists = mkOption {
|
includeExtraUpstreamLists = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Automatically activate upstream list-instagram.txt, list-soundcloud.txt,
|
Automatically activate upstream list-instagram.txt, list-soundcloud.txt,
|
||||||
and list-twitter.txt in the generated zapret config when the selected
|
and list-twitter.txt in the generated zapret config when the selected
|
||||||
|
|||||||
+23
-4
@@ -245,6 +245,18 @@ let
|
|||||||
zapretSyncNoExtraListsBase = mkZapretBase zapretSyncNoExtraListsFixture;
|
zapretSyncNoExtraListsBase = mkZapretBase zapretSyncNoExtraListsFixture;
|
||||||
zapretSyncNoExtraListsRules = mkRoutingRules zapretSyncNoExtraListsFixture;
|
zapretSyncNoExtraListsRules = mkRoutingRules zapretSyncNoExtraListsFixture;
|
||||||
|
|
||||||
|
zapretSyncExtraListsFixture = evalProxySuite [
|
||||||
|
baseModule
|
||||||
|
{
|
||||||
|
services.proxy-suite.zapret = {
|
||||||
|
enable = true;
|
||||||
|
includeExtraUpstreamLists = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
zapretSyncExtraListsBase = mkZapretBase zapretSyncExtraListsFixture;
|
||||||
|
zapretSyncExtraListsRules = mkRoutingRules zapretSyncExtraListsFixture;
|
||||||
|
|
||||||
zapretSyncIpsFixture = evalProxySuite [
|
zapretSyncIpsFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
{
|
{
|
||||||
@@ -575,7 +587,7 @@ let
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
assert hasDirectDomain zapretSyncRules "twitter.com";
|
assert !(hasDirectDomain zapretSyncRules "twitter.com");
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
@@ -598,6 +610,10 @@ let
|
|||||||
assert !(hasDirectDomain zapretSyncNoExtraListsRules "twitter.com");
|
assert !(hasDirectDomain zapretSyncNoExtraListsRules "twitter.com");
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
(
|
||||||
|
assert hasDirectDomain zapretSyncExtraListsRules "twitter.com";
|
||||||
|
true
|
||||||
|
)
|
||||||
(
|
(
|
||||||
assert !(hasDirectIP zapretSyncUserIpsDisabledRules "203.0.113.0/24");
|
assert !(hasDirectIP zapretSyncUserIpsDisabledRules "203.0.113.0/24");
|
||||||
true
|
true
|
||||||
@@ -687,9 +703,12 @@ in
|
|||||||
proxy-suite-module = builtins.seq validated (pkgs.writeText "proxy-suite-module-check" "ok");
|
proxy-suite-module = builtins.seq validated (pkgs.writeText "proxy-suite-module-check" "ok");
|
||||||
|
|
||||||
zapret-hostlist-rules = pkgs.runCommand "proxy-suite-zapret-hostlist-rules-check" { } ''
|
zapret-hostlist-rules = pkgs.runCommand "proxy-suite-zapret-hostlist-rules-check" { } ''
|
||||||
grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-twitter.txt"' "${zapretSyncBase}/config"
|
grep -F -- '--hostlist="${zapretSyncExtraListsBase}/hostlists/list-twitter.txt"' "${zapretSyncExtraListsBase}/config"
|
||||||
grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-instagram.txt"' "${zapretSyncBase}/config"
|
grep -F -- '--hostlist="${zapretSyncExtraListsBase}/hostlists/list-instagram.txt"' "${zapretSyncExtraListsBase}/config"
|
||||||
grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-soundcloud.txt"' "${zapretSyncBase}/config"
|
grep -F -- '--hostlist="${zapretSyncExtraListsBase}/hostlists/list-soundcloud.txt"' "${zapretSyncExtraListsBase}/config"
|
||||||
|
! grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-twitter.txt"' "${zapretSyncBase}/config"
|
||||||
|
! grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-instagram.txt"' "${zapretSyncBase}/config"
|
||||||
|
! grep -F -- '--hostlist="${zapretSyncBase}/hostlists/list-soundcloud.txt"' "${zapretSyncBase}/config"
|
||||||
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-twitter.txt"' "${zapretSyncNoExtraListsBase}/config"
|
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-twitter.txt"' "${zapretSyncNoExtraListsBase}/config"
|
||||||
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-instagram.txt"' "${zapretSyncNoExtraListsBase}/config"
|
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-instagram.txt"' "${zapretSyncNoExtraListsBase}/config"
|
||||||
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-soundcloud.txt"' "${zapretSyncNoExtraListsBase}/config"
|
! grep -F -- '--hostlist="${zapretSyncNoExtraListsBase}/hostlists/list-soundcloud.txt"' "${zapretSyncNoExtraListsBase}/config"
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def main() -> int:
|
|||||||
lines = config_path.read_text(encoding="utf-8").splitlines()
|
lines = config_path.read_text(encoding="utf-8").splitlines()
|
||||||
spec = json.loads(spec_path.read_text(encoding="utf-8"))
|
spec = json.loads(spec_path.read_text(encoding="utf-8"))
|
||||||
entries = spec.get("entries", [])
|
entries = spec.get("entries", [])
|
||||||
include_extra_upstream_lists = spec.get("includeExtraUpstreamLists", True)
|
include_extra_upstream_lists = spec.get("includeExtraUpstreamLists", False)
|
||||||
|
|
||||||
start, end = locate_nfqws_block(lines)
|
start, end = locate_nfqws_block(lines)
|
||||||
nfqws_lines = lines[start + 1 : end]
|
nfqws_lines = lines[start + 1 : end]
|
||||||
|
|||||||
Reference in new issue
Block a user