mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
modules.services.xray: fix mark
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user