feat(wip): xray proxy backend
This commit is contained in:
36 files changed
+2265
-996
No files matched your search
@@ -3,6 +3,7 @@
|
||||
{
|
||||
imports = [
|
||||
./other.nix
|
||||
./legacy-sing-box.nix
|
||||
./sing-box.nix
|
||||
./sing-box-outbounds.nix
|
||||
./sing-box-dns.nix
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
cfg = config.services.proxy-suite;
|
||||
legacy = cfg.singBox or { };
|
||||
legacyUsed = legacy != { };
|
||||
|
||||
has = name: builtins.hasAttr name legacy;
|
||||
hasNested = path: lib.hasAttrByPath path legacy;
|
||||
getNested = path: lib.getAttrFromPath path legacy;
|
||||
setIf = condition: value: lib.optionalAttrs condition value;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = types.anything;
|
||||
};
|
||||
default = { };
|
||||
visible = false;
|
||||
description = ''
|
||||
Deprecated compatibility tree for the old services.proxy-suite.singBox
|
||||
options. Use services.proxy-suite.proxy instead.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf legacyUsed {
|
||||
warnings = [
|
||||
''
|
||||
services.proxy-suite.singBox is deprecated. Move shared options to
|
||||
services.proxy-suite.proxy and SingBox-specific options to
|
||||
services.proxy-suite.proxy.singBox.
|
||||
''
|
||||
];
|
||||
|
||||
services.proxy-suite.proxy = lib.mkMerge [
|
||||
(setIf (!has "enable") {
|
||||
enable = lib.mkDefault true;
|
||||
singBox.enable = lib.mkDefault true;
|
||||
})
|
||||
(setIf (has "enable") {
|
||||
enable = lib.mkDefault legacy.enable;
|
||||
singBox.enable = lib.mkDefault legacy.enable;
|
||||
})
|
||||
(setIf (has "listenAddress") { listenAddress = lib.mkDefault legacy.listenAddress; })
|
||||
(setIf (has "port") { port = lib.mkDefault legacy.port; })
|
||||
(setIf (has "auth") { auth = lib.mkDefault legacy.auth; })
|
||||
(setIf (has "proxyByDefault") { proxyByDefault = lib.mkDefault legacy.proxyByDefault; })
|
||||
(setIf (has "outbounds") { outbounds = lib.mkDefault legacy.outbounds; })
|
||||
(setIf (has "subscriptions") { subscriptions = lib.mkDefault legacy.subscriptions; })
|
||||
(setIf (has "subscriptionUpdateInterval") {
|
||||
subscriptionUpdateInterval = lib.mkDefault legacy.subscriptionUpdateInterval;
|
||||
})
|
||||
(setIf (has "selection") { selection = lib.mkDefault legacy.selection; })
|
||||
(setIf (has "dns") { dns = lib.mkDefault legacy.dns; })
|
||||
(setIf (has "routing") { routing = lib.mkDefault legacy.routing; })
|
||||
(setIf (has "tun") { tun = lib.mkDefault legacy.tun; })
|
||||
(setIf (has "tproxy") { tproxy = lib.mkDefault legacy.tproxy; })
|
||||
(setIf (hasNested [ "urlTest" "url" ]) {
|
||||
urlTest.url = lib.mkDefault (getNested [ "urlTest" "url" ]);
|
||||
})
|
||||
(setIf (hasNested [ "urlTest" "interval" ]) {
|
||||
urlTest.interval = lib.mkDefault (getNested [ "urlTest" "interval" ]);
|
||||
})
|
||||
(setIf (hasNested [ "urlTest" "tolerance" ]) {
|
||||
singBox.urlTest.tolerance = lib.mkDefault (getNested [ "urlTest" "tolerance" ]);
|
||||
})
|
||||
(setIf (has "package") { singBox.package = lib.mkDefault legacy.package; })
|
||||
(setIf (has "clashApiPort") { singBox.clashApiPort = lib.mkDefault legacy.clashApiPort; })
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -6,7 +6,7 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite = {
|
||||
enable = mkEnableOption "proxy suite (sing-box + zapret + tg-ws-proxy)";
|
||||
enable = mkEnableOption "proxy suite (proxy backend + zapret + tg-ws-proxy)";
|
||||
|
||||
userControl = {
|
||||
group = mkOption {
|
||||
@@ -141,7 +141,7 @@ in
|
||||
When enabled and global TUN or TProxy mode is configured, the
|
||||
tg-ws-proxy systemd service receives a packet mark and an earlier
|
||||
policy-routing rule back to the main table. This prevents global TUN
|
||||
from routing the local Telegram MTProto relay through sing-box again,
|
||||
from routing the local Telegram MTProto relay through the proxy backend again,
|
||||
which can otherwise break tg-ws-proxy after enabling TUN mode.
|
||||
'';
|
||||
example = true;
|
||||
|
||||
@@ -20,8 +20,8 @@ in
|
||||
|
||||
Current curated defaults:
|
||||
- `proxychains`: route = "proxychains"
|
||||
- `tun`: route = "tun" when singBox.tun.perApp.enable = true
|
||||
- `tproxy`: route = "tproxy" when singBox.tproxy.perApp.enable = true
|
||||
- `tun`: route = "tun" when proxy.tun.perApp.enable = true
|
||||
- `tproxy`: route = "tproxy" when proxy.tproxy.perApp.enable = true
|
||||
- `zapret`: route = "zapret" when zapret.perApp.enable = true
|
||||
|
||||
This makes `proxy-ctl wrap proxychains -- <command>` available
|
||||
@@ -51,10 +51,10 @@ in
|
||||
- "zapret" for per-app-scoped zapret handling through a separate
|
||||
zapret instance without changing the app's network path or exit IP
|
||||
|
||||
proxychains-based wrapping depends on singBox.enable = true and the
|
||||
local proxy-suite mixed proxy listener provided by sing-box. The
|
||||
"tun" route depends on singBox.tun.perApp.enable = true. The "tproxy"
|
||||
route depends on singBox.tproxy.perApp.enable = true. The "zapret"
|
||||
proxychains-based wrapping depends on proxy.enable = true and the
|
||||
local proxy-suite proxy listener provided by the active backend. The
|
||||
"tun" route depends on proxy.tun.perApp.enable = true. The "tproxy"
|
||||
route depends on proxy.tproxy.perApp.enable = true. The "zapret"
|
||||
route depends on zapret.perApp.enable = true.
|
||||
|
||||
When createDefaultProfiles = true, curated defaults are added on top
|
||||
|
||||
@@ -5,7 +5,7 @@ let
|
||||
t = import ./types.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox.dns = {
|
||||
options.services.proxy-suite.proxy.dns = {
|
||||
local = mkOption {
|
||||
type = t.dnsUpstreamType;
|
||||
default = {
|
||||
@@ -15,7 +15,7 @@ in
|
||||
};
|
||||
description = ''
|
||||
DNS upstream used for the built-in "local" resolver role.
|
||||
This resolver is also used as sing-box route.default_domain_resolver.
|
||||
This resolver is also used as the backend's default domain resolver.
|
||||
|
||||
The module keeps detour policy automatic: in mixed/TProxy mode and
|
||||
per-app-routing TUN mode, "local" stays on the direct path (without an
|
||||
@@ -40,7 +40,7 @@ in
|
||||
DNS upstream used for the built-in "remote" resolver role.
|
||||
|
||||
This resolver always detours through the proxy and becomes the
|
||||
generated dns.final target when singBox.proxyByDefault = true.
|
||||
generated dns.final target when proxy.proxyByDefault = true.
|
||||
'';
|
||||
example = {
|
||||
type = "tls";
|
||||
|
||||
@@ -5,16 +5,18 @@ let
|
||||
t = import ./types.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox = {
|
||||
options.services.proxy-suite.proxy = {
|
||||
outbounds = mkOption {
|
||||
type = types.listOf t.outboundType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of static proxy outbounds.
|
||||
Set exactly one of urlFile, url, or json per entry.
|
||||
Set exactly one of urlFile, url, singBoxJson, xrayJson, or the
|
||||
deprecated json field per entry. Backend-specific raw JSON fields are
|
||||
only valid with their matching backend.
|
||||
|
||||
At least one outbound or one subscription is required when
|
||||
singBox.enable = true.
|
||||
proxy.enable = true.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
@@ -37,12 +39,12 @@ in
|
||||
(standard v2rayN / Clash subscription format) or plain text of the same.
|
||||
|
||||
On first service start, each subscription is fetched live and cached
|
||||
under /var/lib/proxy-suite/subscriptions/<tag>.json. Later restarts
|
||||
under /var/lib/proxy-suite/subscriptions/<backend>/<tag>.json. Later restarts
|
||||
reuse the cache, so ordinary service restarts do not need network access.
|
||||
|
||||
A systemd timer (proxy-suite-subscription-update) refreshes all caches on
|
||||
the interval set by subscriptionUpdateInterval and restarts the running
|
||||
sing-box services after a successful refresh.
|
||||
A systemd timer (proxy-suite-subscription-update) refreshes all caches
|
||||
on the interval set by subscriptionUpdateInterval and restarts the
|
||||
running proxy services after a successful refresh.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
@@ -64,7 +66,7 @@ in
|
||||
all subscription caches. Accepts any systemd time span string
|
||||
(e.g. "1h", "6h", "1d", "12h").
|
||||
|
||||
Only used when singBox.subscriptions is non-empty. The timer also runs
|
||||
Only used when proxy.subscriptions is non-empty. The timer also runs
|
||||
once shortly after boot.
|
||||
'';
|
||||
example = "6h";
|
||||
@@ -86,11 +88,13 @@ in
|
||||
- "selector": create a Clash-compatible selector outbound tagged
|
||||
"proxy" and keep all configured outbounds available for manual
|
||||
switching via the Clash API.
|
||||
- "urltest": create an automatic latency-testing outbound tagged
|
||||
"proxy" and keep all configured outbounds available so sing-box
|
||||
can periodically probe and switch to a faster one.
|
||||
- "urltest": create automatic latency testing tagged "proxy" and
|
||||
keep all configured outbounds available so the active backend can
|
||||
periodically probe and switch to a faster one.
|
||||
|
||||
clashApiPort is only used with "selector" or "urltest".
|
||||
proxy.singBox.clashApiPort is only used with "selector" or "urltest"
|
||||
on the SingBox backend. "selector" is SingBox-only. "urltest" maps to
|
||||
SingBox urltest or XRay observatory/balancer depending on backend.
|
||||
urlTest.* options are only used with "urltest".
|
||||
Per-outbound tags are only individually meaningful with "selector"
|
||||
or "urltest".
|
||||
@@ -103,7 +107,7 @@ in
|
||||
type = types.str;
|
||||
default = "https://www.gstatic.com/generate_204";
|
||||
description = ''
|
||||
URL that sing-box fetches through each proxy to measure latency.
|
||||
URL that the active backend fetches through each proxy to measure latency.
|
||||
Only used when selection = "urltest".
|
||||
|
||||
Set this to a URL that is actually blocked in your region (e.g.
|
||||
@@ -118,35 +122,12 @@ in
|
||||
type = types.str;
|
||||
default = "3m";
|
||||
description = ''
|
||||
How often sing-box re-tests all outbounds. Accepts a Go duration
|
||||
string (e.g. "1m", "3m", "10m").
|
||||
How often the active backend re-tests all outbounds. Accepts a Go
|
||||
duration string (e.g. "1m", "3m", "10m").
|
||||
Only used when selection = "urltest".
|
||||
'';
|
||||
example = "1m";
|
||||
};
|
||||
|
||||
tolerance = mkOption {
|
||||
type = types.int;
|
||||
default = 50;
|
||||
description = ''
|
||||
Latency tolerance in milliseconds. The current proxy is only replaced
|
||||
when a competing one is faster by more than this value.
|
||||
|
||||
Only used when selection = "urltest".
|
||||
'';
|
||||
example = 100;
|
||||
};
|
||||
};
|
||||
|
||||
clashApiPort = mkOption {
|
||||
type = types.port;
|
||||
default = 9090;
|
||||
description = ''
|
||||
Port for the Clash-compatible REST API exposed by sing-box.
|
||||
Only used when selection is "selector" or "urltest". Ignored in
|
||||
"first" mode because there is no selector-style outbound to control.
|
||||
'';
|
||||
example = 9090;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,7 @@ let
|
||||
t = import ./types.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox.routing = {
|
||||
options.services.proxy-suite.proxy.routing = {
|
||||
enableRuDirect = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
@@ -98,7 +98,7 @@ in
|
||||
The outbound can be a configured outbound tag (useful with selector/urltest),
|
||||
or one of: "proxy" (active proxy), "direct", "block".
|
||||
|
||||
Order is preserved. The first matching rule wins in sing-box.
|
||||
Order is preserved. The first matching rule wins in the active backend.
|
||||
With selection = "first", non-built-in outbound tags are effectively
|
||||
routed to the single active "proxy" outbound.
|
||||
'';
|
||||
|
||||
@@ -4,8 +4,8 @@ let
|
||||
inherit (lib) mkOption mkEnableOption types;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox.tproxy = {
|
||||
enable = mkEnableOption "global sing-box TProxy mode service";
|
||||
options.services.proxy-suite.proxy.tproxy = {
|
||||
enable = mkEnableOption "global proxy TProxy mode service";
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
@@ -13,7 +13,7 @@ in
|
||||
description = ''
|
||||
Whether to start proxy-suite-tproxy automatically during boot by
|
||||
attaching it to multi-user.target.
|
||||
Cannot be enabled together with singBox.tun.autostart.
|
||||
Cannot be enabled together with proxy.tun.autostart.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
@@ -22,7 +22,7 @@ in
|
||||
type = types.port;
|
||||
default = 1081;
|
||||
description = ''
|
||||
Local listen port for sing-box's TProxy inbound.
|
||||
Local listen port for the proxy backend's TProxy inbound.
|
||||
nftables redirection created by proxy-suite-tproxy sends intercepted
|
||||
TCP/UDP traffic to this port.
|
||||
'';
|
||||
@@ -35,7 +35,7 @@ in
|
||||
description = ''
|
||||
Mark applied to intercepted packets in global TProxy mode.
|
||||
A matching `ip rule` routes this mark to
|
||||
singBox.tproxy.routeTable, which points traffic to
|
||||
proxy.tproxy.routeTable, which points traffic to
|
||||
loopback for local proxy processing.
|
||||
'';
|
||||
example = 1;
|
||||
@@ -45,7 +45,7 @@ in
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = ''
|
||||
Mark applied to sing-box egress packets in global TProxy mode so
|
||||
Mark applied to backend egress packets in global TProxy mode so
|
||||
they bypass re-interception and do not loop back into the
|
||||
transparent proxy path.
|
||||
'';
|
||||
@@ -58,7 +58,7 @@ in
|
||||
description = ''
|
||||
Policy-routing table number used for global TProxy interception flow.
|
||||
The module installs a local default route in this table and binds it
|
||||
to singBox.tproxy.fwmark.
|
||||
to proxy.tproxy.fwmark.
|
||||
'';
|
||||
example = 100;
|
||||
};
|
||||
@@ -81,7 +81,7 @@ in
|
||||
};
|
||||
|
||||
perApp = {
|
||||
enable = mkEnableOption "per-app-scoped sing-box TProxy backend for perAppRouting profiles";
|
||||
enable = mkEnableOption "per-app-scoped proxy TProxy backend for perAppRouting profiles";
|
||||
|
||||
fwmark = mkOption {
|
||||
type = types.int;
|
||||
|
||||
@@ -36,8 +36,8 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox.tun = {
|
||||
enable = mkEnableOption "global sing-box TUN mode service";
|
||||
options.services.proxy-suite.proxy.tun = {
|
||||
enable = mkEnableOption "global proxy TUN mode service";
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
@@ -45,13 +45,13 @@ in
|
||||
description = ''
|
||||
Whether to start proxy-suite-tun automatically during boot by
|
||||
attaching it to multi-user.target.
|
||||
Cannot be enabled together with singBox.tproxy.autostart.
|
||||
Cannot be enabled together with proxy.tproxy.autostart.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
perApp = {
|
||||
enable = mkEnableOption "per-app-scoped sing-box TUN backend for perAppRouting profiles";
|
||||
enable = mkEnableOption "per-app-scoped proxy TUN backend for perAppRouting profiles";
|
||||
|
||||
fwmark = mkOption {
|
||||
type = types.int;
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
# Core sing-box options. Feature-area options live in sing-box-{outbounds,dns,tun,tproxy,routing}.nix.
|
||||
# Core proxy options. Feature-area options live in sing-box-{outbounds,dns,tun,tproxy,routing}.nix.
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) literalExpression mkOption mkEnableOption types;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.singBox = {
|
||||
options.services.proxy-suite.proxy = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to configure and run sing-box services for proxy-suite.
|
||||
When disabled, sing-box services and generated sing-box configs are
|
||||
skipped even if proxy-suite itself is enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sing-box;
|
||||
defaultText = literalExpression "pkgs.sing-box";
|
||||
example = literalExpression "pkgs.sing-box";
|
||||
description = ''
|
||||
sing-box package used by proxy-suite systemd services.
|
||||
|
||||
Override this to pin or test a specific sing-box build when upstream
|
||||
protocol behavior changes.
|
||||
Whether to configure and run the proxy backend services.
|
||||
This is disabled by default; enable it explicitly and choose exactly
|
||||
one backend with proxy.singBox.enable or proxy.xray.enable.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -33,8 +20,8 @@ in
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
description = ''
|
||||
Address for the SOCKS5/HTTP mixed inbound to bind to.
|
||||
This affects the always-on proxy-suite-socks service.
|
||||
Address for the local SOCKS5/HTTP inbound to bind to.
|
||||
This affects the proxy-suite-socks service.
|
||||
|
||||
Use "0.0.0.0" only if you intentionally want to expose the proxy to
|
||||
other machines on your network.
|
||||
@@ -46,8 +33,9 @@ in
|
||||
type = types.port;
|
||||
default = 1080;
|
||||
description = ''
|
||||
Listen port for the always-on SOCKS5/HTTP mixed inbound provided by
|
||||
proxy-suite-socks.
|
||||
Listen port for the local SOCKS5/HTTP proxy inbound provided by
|
||||
proxy-suite-socks. SingBox exposes SOCKS5 and HTTP on this port.
|
||||
XRay's Socks inbound also accepts SOCKS and HTTP.
|
||||
'';
|
||||
example = 1080;
|
||||
};
|
||||
@@ -102,10 +90,70 @@ in
|
||||
Whether traffic that does not match any explicit routing rule should
|
||||
go through the proxy or go direct.
|
||||
|
||||
This affects sing-box route.final and dns.final in the generated
|
||||
This affects the generated backend route final and DNS final in the
|
||||
config.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
singBox = {
|
||||
enable = mkEnableOption "SingBox proxy backend";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sing-box;
|
||||
defaultText = literalExpression "pkgs.sing-box";
|
||||
example = literalExpression "pkgs.sing-box";
|
||||
description = ''
|
||||
sing-box package used by proxy-suite systemd services.
|
||||
|
||||
Override this to pin or test a specific sing-box build when upstream
|
||||
protocol behavior changes.
|
||||
'';
|
||||
};
|
||||
|
||||
clashApiPort = mkOption {
|
||||
type = types.port;
|
||||
default = 9090;
|
||||
description = ''
|
||||
Port for the Clash-compatible REST API exposed by sing-box.
|
||||
Only used when proxy.selection is "selector" or "urltest". Ignored
|
||||
in "first" mode because there is no selector-style outbound to
|
||||
control.
|
||||
'';
|
||||
example = 9090;
|
||||
};
|
||||
|
||||
urlTest.tolerance = mkOption {
|
||||
type = types.int;
|
||||
default = 50;
|
||||
description = ''
|
||||
Latency tolerance in milliseconds for sing-box urltest. The current
|
||||
proxy is only replaced when a competing one is faster by more than
|
||||
this value.
|
||||
|
||||
Only used when proxy.selection = "urltest" and the SingBox backend
|
||||
is active.
|
||||
'';
|
||||
example = 100;
|
||||
};
|
||||
};
|
||||
|
||||
xray = {
|
||||
enable = mkEnableOption "XRay proxy backend";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.xray;
|
||||
defaultText = literalExpression "pkgs.xray";
|
||||
example = literalExpression "pkgs.xray";
|
||||
description = ''
|
||||
XRay package used by proxy-suite systemd services.
|
||||
|
||||
Override this to pin or test a specific XRay build when upstream
|
||||
protocol behavior changes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -32,7 +32,7 @@ let
|
||||
default = [ ];
|
||||
description = ''
|
||||
sing-geosite rule-set names to match in this routing rule.
|
||||
Each name becomes a sing-box geosite rule-set reference.
|
||||
Each name becomes a backend geosite rule-set reference.
|
||||
'';
|
||||
example = [
|
||||
"netflix"
|
||||
@@ -44,7 +44,7 @@ let
|
||||
default = [ ];
|
||||
description = ''
|
||||
sing-geoip rule-set names to match in this routing rule.
|
||||
Each name becomes a sing-box geoip rule-set reference.
|
||||
Each name becomes a backend geoip rule-set reference.
|
||||
'';
|
||||
example = [
|
||||
"us"
|
||||
@@ -83,7 +83,8 @@ let
|
||||
e.g. "my-sub" -> tags like "my-sub-Server-DE".
|
||||
|
||||
This value is also used as the subscription cache filename stem under
|
||||
/var/lib/proxy-suite/subscriptions/, so it must be a safe identifier.
|
||||
/var/lib/proxy-suite/subscriptions/<backend>/, so it must be a safe
|
||||
identifier.
|
||||
'';
|
||||
example = "community-list";
|
||||
};
|
||||
@@ -125,7 +126,7 @@ let
|
||||
Outbound tag used in routing rules and multi-outbound selection.
|
||||
|
||||
With selection = "selector" or "urltest", each outbound keeps its own
|
||||
tag and can be selected directly. With selection = "first", sing-box
|
||||
tag and can be selected directly. With selection = "first", proxy-suite
|
||||
routes through a single active outbound tagged "proxy", so individual
|
||||
proxy tags are mainly useful for documentation and config structure.
|
||||
'';
|
||||
@@ -158,7 +159,7 @@ let
|
||||
example = "hy2://password@example.com:443?sni=example.com";
|
||||
};
|
||||
|
||||
json = mkOption {
|
||||
singBoxJson = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
description = ''
|
||||
@@ -166,9 +167,10 @@ let
|
||||
Embedded directly into the config at build time. The tag field
|
||||
is overridden by the outbound's tag option.
|
||||
|
||||
Set exactly one of urlFile, url, or json for each outbound.
|
||||
Set exactly one of urlFile, url, singBoxJson, xrayJson, or json for
|
||||
each outbound.
|
||||
Use this when the proxy definition is easier to generate as native Nix
|
||||
than as a single URL string.
|
||||
than as a single URL string. Only valid with the SingBox backend.
|
||||
'';
|
||||
example = {
|
||||
type = "vless";
|
||||
@@ -178,6 +180,37 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
xrayJson = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
description = ''
|
||||
Raw XRay outbound configuration as a Nix attribute set.
|
||||
Embedded directly into the config at build time. The tag field is
|
||||
overridden by the outbound's tag option.
|
||||
|
||||
Set exactly one of urlFile, url, singBoxJson, xrayJson, or json for
|
||||
each outbound. Only valid with the XRay backend.
|
||||
'';
|
||||
example = {
|
||||
protocol = "vless";
|
||||
settings = {
|
||||
address = "example.com";
|
||||
port = 443;
|
||||
id = "...";
|
||||
encryption = "none";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
json = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
visible = false;
|
||||
description = ''
|
||||
Deprecated alias for singBoxJson. Use singBoxJson instead.
|
||||
'';
|
||||
};
|
||||
|
||||
# Shorthand for attaching routing rules directly to an outbound definition.
|
||||
# Traffic matching these patterns is sent to this specific outbound.
|
||||
# Only meaningful when selection = "selector" or "urltest" (with "first",
|
||||
@@ -196,7 +229,7 @@ let
|
||||
];
|
||||
default = "udp";
|
||||
description = ''
|
||||
sing-box DNS transport type for this upstream resolver.
|
||||
DNS transport type for this upstream resolver.
|
||||
'';
|
||||
example = "tls";
|
||||
};
|
||||
@@ -280,7 +313,7 @@ let
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether this custom hostlist should also be mirrored into sing-box
|
||||
Whether this custom hostlist should also be mirrored into proxy
|
||||
direct domain routing when zapret.syncDirectRouting = true.
|
||||
'';
|
||||
};
|
||||
@@ -317,7 +350,7 @@ let
|
||||
only that app's traffic is policy-routed into the app TUN backend.
|
||||
- "tproxy": launch the command in the dedicated per-app-routing TProxy
|
||||
slice so only that app's traffic is transparently intercepted by
|
||||
the local sing-box TProxy inbound.
|
||||
the local proxy TProxy inbound.
|
||||
- "zapret": launch the command in the dedicated per-app-routing zapret
|
||||
slice so only that app's traffic is handled by the separate
|
||||
per-app-scoped zapret instance.
|
||||
|
||||
@@ -39,7 +39,7 @@ in
|
||||
default = true;
|
||||
description = ''
|
||||
When zapret.enable = true, mirror zapret's upstream domain hostlists
|
||||
into sing-box direct domain routing.
|
||||
into proxy direct domain routing.
|
||||
|
||||
This includes the default zapret domain lists and any custom
|
||||
hostlistRules entries with enableDirectSync = true.
|
||||
@@ -52,7 +52,7 @@ in
|
||||
default = false;
|
||||
description = ''
|
||||
When zapret.enable = true, mirror zapret's upstream ipset ranges
|
||||
(such as ipset-all.txt minus exclusions) into sing-box direct IP routing.
|
||||
(such as ipset-all.txt minus exclusions) into proxy direct IP routing.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
@@ -62,7 +62,7 @@ in
|
||||
default = true;
|
||||
description = ''
|
||||
When zapret.enable = true, mirror user-defined zapret.ipsetAll and
|
||||
zapret.ipsetExclude entries into sing-box direct IP routing.
|
||||
zapret.ipsetExclude entries into proxy direct IP routing.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
@@ -87,7 +87,7 @@ in
|
||||
description = ''
|
||||
Extra domains to include in zapret's interception list.
|
||||
When syncDirectRouting = true, these domains are also mirrored into
|
||||
sing-box direct routing.
|
||||
proxy direct routing.
|
||||
'';
|
||||
example = [ "youtube.com" ];
|
||||
};
|
||||
@@ -98,7 +98,7 @@ in
|
||||
description = ''
|
||||
Domains to exclude from zapret interception.
|
||||
When syncDirectRouting = true, these exclusions also remove matching
|
||||
domains from the zapret-derived sing-box direct-routing set.
|
||||
domains from the zapret-derived proxy direct-routing set.
|
||||
'';
|
||||
example = [ "music.youtube.com" ];
|
||||
};
|
||||
@@ -108,7 +108,7 @@ in
|
||||
default = [ ];
|
||||
description = ''
|
||||
Extra IPs/CIDRs to add to zapret's ipset.
|
||||
Mirrored into sing-box direct IP routing when
|
||||
Mirrored into proxy direct IP routing when
|
||||
syncDirectRoutingUserIps = true.
|
||||
'';
|
||||
example = [ "203.0.113.0/24" ];
|
||||
@@ -119,7 +119,7 @@ in
|
||||
default = [ ];
|
||||
description = ''
|
||||
IPs/CIDRs to exclude from zapret's ipset.
|
||||
Also excluded from zapret-derived sing-box direct IP routing when
|
||||
Also excluded from zapret-derived proxy direct IP routing when
|
||||
syncDirectRoutingUserIps = true.
|
||||
'';
|
||||
example = [ "203.0.113.10/32" ];
|
||||
@@ -134,7 +134,7 @@ in
|
||||
upstream preset does not already reference them.
|
||||
|
||||
When syncDirectRouting = true, domains from these extra lists are also
|
||||
mirrored into sing-box direct routing.
|
||||
mirrored into proxy direct routing.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user