add tproxy/tun autostart option
This commit is contained in:
5 files changed
+182
-2
No files matched your search
@@ -491,6 +491,18 @@ in
|
||||
tun = {
|
||||
enable = mkEnableOption "TUN mode service (opt-in, mutually exclusive with proxy-suite-tproxy)";
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to start proxy-suite-tun automatically during boot by
|
||||
attaching it to multi-user.target.
|
||||
Only relevant when singBox.tun.enable = true.
|
||||
Cannot be enabled together with singBox.tproxy.autostart.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
default = "singtun0";
|
||||
@@ -525,6 +537,18 @@ in
|
||||
tproxy = {
|
||||
enable = mkEnableOption "TProxy mode service (opt-in, transparent proxy via nftables)";
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to start proxy-suite-tproxy automatically during boot by
|
||||
attaching it to multi-user.target.
|
||||
Only relevant when singBox.tproxy.enable = true.
|
||||
Cannot be enabled together with singBox.tun.autostart.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
localSubnets = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "192.168.0.0/16" ];
|
||||
|
||||
@@ -420,6 +420,10 @@ in
|
||||
assertion = invalidRoutingTargets == [ ];
|
||||
message = "proxy-suite: routing.rules reference unknown outbound tag(s): ${lib.concatStringsSep ", " invalidRoutingTargets}";
|
||||
}
|
||||
{
|
||||
assertion = !(sb.tproxy.enable && sb.tproxy.autostart && sb.tun.enable && sb.tun.autostart);
|
||||
message = "proxy-suite: singBox.tproxy.autostart and singBox.tun.autostart cannot both be enabled at the same time";
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
!t.enable
|
||||
@@ -484,6 +488,7 @@ in
|
||||
"network.target"
|
||||
"proxy-suite-socks.service"
|
||||
];
|
||||
wantedBy = lib.optionals sb.tproxy.autostart [ "multi-user.target" ];
|
||||
requires = [ "proxy-suite-socks.service" ];
|
||||
conflicts = [ "proxy-suite-tun.service" ];
|
||||
serviceConfig = {
|
||||
@@ -510,6 +515,7 @@ in
|
||||
proxy-suite-tun = {
|
||||
description = "sing-box TUN proxy client";
|
||||
after = [ "network-online.target" ];
|
||||
wantedBy = lib.optionals sb.tun.autostart [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
conflicts = [ "proxy-suite-tproxy.service" ];
|
||||
serviceConfig = {
|
||||
|
||||
Reference in new issue
Block a user