feat: tor support

This commit is contained in:
FUFSoB committed 2026-09-17 20:12:17 +05:00
1 parent 97332c1774
commit 321e9ca468
42 files changed
+1853 -69

No files matched your search

+15 -1
View File
@@ -4,6 +4,7 @@
lib,
proxyInboundsCfg,
proxyInbounds,
proxyInboundsRouteOnion,
zapretDirectRules,
}:
@@ -17,6 +18,18 @@ let
# A blocked listener stays blocked: neither serverAddress nor the proxy exceptions open it.
exceptionInboundTags = map (ib: ib.tag) (builtins.filter (ib: ib.via != "block") proxyInbounds);
# Only Tor reaches .onion: to the local proxy, whose own rule sends it there. First, so no
# IP rule before it has XRay look the name up, which would leak it to a resolver.
onionRule = lib.optional proxyInboundsRouteOnion {
type = "field";
ruleTag = "inbound-tor-onion";
domain = [ "domain:onion" ];
inboundTag = map (ib: ib.tag) (
builtins.filter (ib: ib.via != "block" && ib.listener.type != "amneziawg") proxyInbounds
);
outboundTag = "proxy";
};
blockPrivateRule = lib.optional proxyInboundsCfg.routing.blockPrivate {
type = "field";
ruleTag = "inbound-block-private";
@@ -147,7 +160,8 @@ let
# Explicit proxy exceptions beat blockRu: RU-geolocated ranges (Telegram's,
# at times) would otherwise swallow them.
xrayInboundRules =
blockPrivateRule
onionRule
++ blockPrivateRule
++ serverAddressRule
++ proxyDomainRule
++ proxyIpRule