modules.services.xray: fix mark

This commit is contained in:
2025-06-05 19:48:05 +08:00
parent b8f27cc8e9
commit 21e9f53b39

View File

@@ -199,9 +199,9 @@ inputs:
};
secrets."xray-client/uuid" = {};
};
systemd.services =
systemd =
{
xray =
services.xray =
{
serviceConfig =
{
@@ -216,26 +216,11 @@ inputs:
};
restartTriggers = [ inputs.config.sops.templates."xray-client.json".file ];
};
v2ray-forwarder =
network.networks."10-xray" =
{
description = "v2ray-forwarder Daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = let ip = "${inputs.pkgs.iproute2}/bin/ip"; in
{
Type = "oneshot";
RemainAfterExit = true;
ExecStart = inputs.pkgs.writeShellScript "v2ray-forwarder.start"
''
${ip} rule add fwmark 1/1 table 100
${ip} route add local 0.0.0.0/0 dev lo table 100
'';
ExecStop = inputs.pkgs.writeShellScript "v2ray-forwarder.stop"
''
${ip} rule del fwmark 1/1 table 100
${ip} route del local 0.0.0.0/0 dev lo table 100
'';
};
matchConfig.Name = "*";
routes = [{ Destination = "0.0.0.0/0"; Type = "local"; Scope = "host"; Table = 100; }];
routingPolicyRules = [{ FirewallMark = "1/1"; Table = 100; }];
};
};
users =