From ac1d4919c03019fac50e36cbe39dc6435033e7aa Mon Sep 17 00:00:00 2001 From: chn Date: Sat, 15 Nov 2025 21:59:10 +0800 Subject: [PATCH] modules.services.xray: default not as router --- modules/services/xray/client.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/services/xray/client.nix b/modules/services/xray/client.nix index 46ae1a45..09d45e78 100644 --- a/modules/services/xray/client.nix +++ b/modules/services/xray/client.nix @@ -19,6 +19,7 @@ inputs: extraInterfaces = mkOption { type = types.listOf types.nonEmptyStr; default = []; }; hosts = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; }; }; + v2ray-forwarder.asRouter = mkOption { type = types.bool; default = false; }; };})); default = null; }; @@ -289,6 +290,9 @@ inputs: fib daddr type local ct state new counter ct mark set ct mark | 1 return ct mark & 1 == 1 counter return + # 如果不作为路由器使用,则可以返回那些没有被标记的流量 + ${if client.v2ray-forwarder.asRouter then "" else "meta mark & 1 == 0 counter return"} + ip saddr @noproxy_src_net counter return ip daddr @noproxy_net counter return ip saddr != 172.16.0.0/12 ip daddr @xmu_net meta l4proto { tcp, udp } counter \