docs: improve the wording, add targeted examples
This commit is contained in:
61 files changed
+3422
-5861
No files matched your search
@@ -16,24 +16,24 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.amneziaWg = {
|
||||
enable = mkEnableOption "native AmneziaWG client profiles";
|
||||
enable = mkEnableOption "AmneziaWG client profiles";
|
||||
|
||||
toolsPackage = mkOption {
|
||||
type = types.package;
|
||||
default = awgPackages.tools;
|
||||
description = "AWG 3.1 package providing awg and awg-quick.";
|
||||
description = "AWG 3.1 package with `awg` and `awg-quick`.";
|
||||
};
|
||||
|
||||
userspacePackage = mkOption {
|
||||
type = types.package;
|
||||
default = awgPackages.userspace;
|
||||
description = "AWG 3.1 userspace implementation used when the kernel interface is unavailable.";
|
||||
description = "AWG 3.1 userspace implementation, used when the kernel module is unavailable.";
|
||||
};
|
||||
|
||||
wireproxyPackage = mkOption {
|
||||
type = types.package;
|
||||
default = awgPackages.wireproxy;
|
||||
description = "wireproxy build with AWG 3.1 and FwMark, which runs profiles with asOutbound = \"userspace\".";
|
||||
description = "wireproxy build with AWG 3.1, used by profiles with `asOutbound = \"userspace\"`.";
|
||||
};
|
||||
|
||||
kernelModulePackage = mkOption {
|
||||
@@ -43,19 +43,18 @@ in
|
||||
kernelPackages = config.services.proxy-suite.host.kernelPackages;
|
||||
in
|
||||
if kernelPackages == null then null else awgPackages.kernelModule kernelPackages;
|
||||
description = "AWG 3.1 kernel module package. Set null to use userspace-only fallback.";
|
||||
description = "AWG 3.1 kernel module package. `null`: userspace only.";
|
||||
};
|
||||
|
||||
profiles = mkOption {
|
||||
type = types.attrsOf t.profileType;
|
||||
default = { };
|
||||
description = ''
|
||||
Named AmneziaWG client profiles. Only one global profile can be active.
|
||||
AmneziaWG client profiles, by name. Each sets exactly one of `configFile`, `vpnFile`, `vpn`
|
||||
or `settings`. Only one global profile can run at a time.
|
||||
|
||||
A profile moves to a new source port, keeping its routes, when a handshake goes
|
||||
unanswered: every 5 seconds while it starts (it gives up after 20), and when
|
||||
proxy-suite-awg-NAME-watchdog sees a rekey not getting through. settings.listenPort
|
||||
pins the port and turns that off.
|
||||
When handshakes go unanswered, a profile switches to a new source port on its own.
|
||||
Setting `settings.listenPort` pins the port and turns this off.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,8 +11,8 @@ in
|
||||
default = pkgs.v2ray-rules-dat;
|
||||
defaultText = literalExpression "pkgs.v2ray-rules-dat";
|
||||
description = ''
|
||||
Package with share/v2ray/{geoip,geosite}.dat for every XRay process. Null uses XRay's own
|
||||
country-only data, where a tag like "geoip:telegram" stops XRay from starting.
|
||||
Package with share/v2ray/{geoip,geosite}.dat for XRay. `null`: XRay's built-in data,
|
||||
which only has countries, so a tag like "geoip:telegram" breaks XRay.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ in
|
||||
type = types.package;
|
||||
default = pkgs.sing-geoip;
|
||||
defaultText = literalExpression "pkgs.sing-geoip";
|
||||
description = "Package with share/sing-box/rule-set/geoip-NAME.srs (country codes by default).";
|
||||
description = "Package with share/sing-box/rule-set/geoip-NAME.srs (countries by default).";
|
||||
};
|
||||
|
||||
geosite = mkOption {
|
||||
|
||||
@@ -5,21 +5,20 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.gui = {
|
||||
enable = mkEnableOption "Proxy Suite GUI, a desktop app with a tray icon for everything proxy-ctl controls at runtime";
|
||||
enable = mkEnableOption "Proxy Suite GUI, a desktop app with a tray icon";
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Start the GUI hidden in the tray with graphical sessions, as the
|
||||
`proxy-suite-gui` systemd user unit on `graphical-session.target`.
|
||||
Start the GUI in the tray on login to a graphical session.
|
||||
'';
|
||||
};
|
||||
|
||||
refreshInterval = mkOption {
|
||||
type = types.ints.positive;
|
||||
default = 3;
|
||||
description = "Status refresh interval, in seconds.";
|
||||
description = "How often the status refreshes, in seconds.";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -13,46 +13,46 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.inbounds = {
|
||||
enable = mkEnableOption "server inbounds that accept proxy connections from outside";
|
||||
enable = mkEnableOption "server inbounds, which accept proxy clients from outside";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = proxySuiteUpstream.xray;
|
||||
defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)";
|
||||
example = literalExpression "pkgs.xray";
|
||||
description = "XRay package serving the inbounds, whatever the client-side backend.";
|
||||
description = "XRay package that runs the inbounds, whichever client backend is used.";
|
||||
};
|
||||
|
||||
serverAddress = mkOption {
|
||||
type = types.nullOr (types.strMatching "[^[:space:]]+");
|
||||
default = null;
|
||||
description = "Public address clients connect to, used in share links. Null detects the uplink IPv4.";
|
||||
description = "Public address for share links. `null`: detect the uplink IPv4.";
|
||||
example = "vpn.example.com";
|
||||
};
|
||||
|
||||
openFirewall = bool true "Open every non-loopback listener port.";
|
||||
shareLinks = bool true "Write client share links for `proxy-ctl inbounds link` (root, and userControl.group with the secrets scope).";
|
||||
openFirewall = bool true "Open the firewall for every listener not on loopback.";
|
||||
shareLinks = bool true "Generate client share links for `proxy-ctl inbounds link`. Readable by root, and by `userControl.group` with the secrets scope.";
|
||||
|
||||
subscriptions = {
|
||||
enable = mkEnableOption "" // {
|
||||
description = ''
|
||||
Write one subscription file per user (their links from every listener, base64) to
|
||||
/run/proxy-suite-inbounds/subscriptions/<token>. Serve that directory with a web server;
|
||||
see the README.
|
||||
Generate a subscription per user, with their links from every listener, in
|
||||
/run/proxy-suite-inbounds/subscriptions/<token>. Serve that directory with a web server.
|
||||
Needs `shareLinks`.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "nginx";
|
||||
description = "Group allowed to read the subscription files: the web server serving them.";
|
||||
description = "Group of the web server that serves the subscription files.";
|
||||
example = "caddy";
|
||||
};
|
||||
|
||||
baseUrl = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "URL the subscription directory is served at, for `proxy-ctl inbounds sub`.";
|
||||
description = "Public URL of the subscription directory, used by `proxy-ctl inbounds sub`.";
|
||||
example = "https://vpn.example.com/sub";
|
||||
};
|
||||
};
|
||||
@@ -63,27 +63,27 @@ in
|
||||
type = types.str;
|
||||
default = "proxy";
|
||||
description = ''
|
||||
Default egress of inbound traffic; listeners can override it:
|
||||
- "proxy": through the local proxy and its current selection (needs proxy.enable).
|
||||
- a proxy.outbounds tag: pinned to that server (url, urlFile or xrayJson outbounds only).
|
||||
- "direct": out from this machine.
|
||||
Where client traffic exits by default. Each listener can override it.
|
||||
- "proxy": through the local proxy and its current pick (needs `proxy.enable`).
|
||||
- an outbound tag from `proxy.outbounds`: always that one (`url`, `urlFile` or `xrayJson` only).
|
||||
- "direct": straight from this host.
|
||||
- "block": dropped.
|
||||
'';
|
||||
example = "direct";
|
||||
};
|
||||
|
||||
proxy = t.routingFields;
|
||||
proxy = t.routingFields "that clients always reach through the local proxy, whatever the listener's `via`";
|
||||
|
||||
blockRu = bool true ''Block Russian destinations (geosite "category-ru", geoip "ru").'';
|
||||
blockPrivate = bool true "Block private and loopback destinations, so clients cannot reach this host's LAN or local services.";
|
||||
blockPrivate = bool true "Block private and loopback addresses, so clients cannot reach this host's LAN or local services.";
|
||||
|
||||
zapretDirect = bool true "Send zapret's hostlist destinations direct, so this host's zapret unblocks them (default via only).";
|
||||
zapretDirect = bool true "Send zapret hostlist sites direct, so this host's zapret unblocks them. Only for the default `via`.";
|
||||
};
|
||||
|
||||
listeners = mkOption {
|
||||
type = types.attrsOf t.inboundType;
|
||||
default = { };
|
||||
description = "Listeners by tag.";
|
||||
description = "Server listeners, by tag.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
vless-reality = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.services.proxy-suite.killSwitch.enable = lib.mkEnableOption ''
|
||||
a kill switch for the global tunnels (proxy.tun, proxy.tproxy and global AmneziaWG profiles):
|
||||
once one starts, outgoing traffic that would leave outside it is rejected, also while it
|
||||
restarts, after it crashes or after its handshake gives up. LAN destinations, DHCP and NTP
|
||||
stay open; tproxy.lanInterfaces clients keep the LAN but lose the internet. Only
|
||||
`proxy-ctl killswitch off`, `proxy off`, `proxy tun off`, `proxy tproxy off` or `awg off`
|
||||
lift it (proxy-suite-killswitch)
|
||||
'';
|
||||
options.services.proxy-suite.killSwitch.enable = lib.mkEnableOption "the kill switch" // {
|
||||
description = ''
|
||||
Block outgoing traffic that bypasses the active global tunnel (TUN, TProxy or a global
|
||||
AmneziaWG profile), including while it restarts or after it fails. LAN, DHCP and NTP stay
|
||||
open; `proxy.tproxy.lanInterfaces` devices keep the LAN but lose the internet. Only turning
|
||||
the tunnel off, or `proxy-ctl killswitch off`, lifts it.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -24,8 +24,8 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Add a profile named after each enabled backend (proxychains, tun, tproxy, zapret) unless
|
||||
one with that name already exists.
|
||||
Add a profile for each enabled method (proxychains, tun, tproxy, zapret), named after it,
|
||||
unless one already exists.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -42,53 +42,53 @@ in
|
||||
};
|
||||
|
||||
proxychains = {
|
||||
enable = mkEnableOption "the proxychains backend (TCP apps, through LD_PRELOAD)";
|
||||
enable = mkEnableOption "proxychains (TCP only, does not work with static binaries)";
|
||||
|
||||
quiet = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Silence proxychains (quiet_mode).";
|
||||
description = "Hide proxychains output.";
|
||||
};
|
||||
|
||||
proxyDns = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Resolve DNS through the proxy (proxy_dns).";
|
||||
description = "Resolve DNS through the proxy.";
|
||||
};
|
||||
};
|
||||
|
||||
tun = {
|
||||
enable = mkEnableOption "the per-app TUN backend";
|
||||
fwmark = int 16 "Mark that steers wrapped apps into routeTable.";
|
||||
routeTable = int 101 "Policy-routing table of the per-app TUN.";
|
||||
localSubnets = localSubnets "Subnets wrapped apps reach directly (DNS excepted).";
|
||||
enable = mkEnableOption "per-app TUN";
|
||||
fwmark = int 16 "Firewall mark for wrapped apps' traffic.";
|
||||
routeTable = int 101 "Routing table for the per-app TUN.";
|
||||
localSubnets = localSubnets "Subnets that skip the proxy (DNS still goes through it).";
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
default = "psperapptun0";
|
||||
description = "Per-app TUN interface name.";
|
||||
description = "Interface name.";
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
default = "172.20.0.1/30";
|
||||
description = "Per-app TUN interface address (CIDR).";
|
||||
description = "Interface address (CIDR).";
|
||||
};
|
||||
|
||||
mtu = int 1400 "Per-app TUN interface MTU.";
|
||||
mtu = int 1400 "Interface MTU.";
|
||||
};
|
||||
|
||||
tproxy = {
|
||||
enable = mkEnableOption "the per-app TProxy backend";
|
||||
fwmark = int 17 "Mark that steers wrapped apps into routeTable.";
|
||||
routeTable = int 102 "Policy-routing table of the per-app TProxy.";
|
||||
localSubnets = localSubnets "Subnets that bypass interception (DNS excepted).";
|
||||
enable = mkEnableOption "per-app TProxy";
|
||||
fwmark = int 17 "Firewall mark for wrapped apps' traffic.";
|
||||
routeTable = int 102 "Routing table for the per-app TProxy.";
|
||||
localSubnets = localSubnets "Subnets that skip the proxy (DNS still goes through it).";
|
||||
};
|
||||
|
||||
zapret = {
|
||||
enable = mkEnableOption "the per-app zapret backend: a second zapret instance for wrapped apps only";
|
||||
filterMark = int 268435456 "Mark bit that selects wrapped app traffic.";
|
||||
qnum = int 201 "NFQUEUE number. Must differ from the global instance's.";
|
||||
enable = mkEnableOption "per-app zapret, a separate zapret for wrapped apps only";
|
||||
filterMark = int 268435456 "Firewall mark bit for wrapped apps' traffic.";
|
||||
qnum = int 201 "NFQUEUE number. Must differ from the global zapret's.";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -20,9 +20,8 @@ in
|
||||
type = "tcp";
|
||||
};
|
||||
description = ''
|
||||
Resolver for direct traffic and the default domain resolver. Goes through the proxy in
|
||||
global TUN mode. TCP by default: plain UDP queries to well-known resolvers are often
|
||||
answered by the ISP's DPI instead, which breaks blocked names routed direct to zapret.
|
||||
Resolver for direct traffic. In global TUN mode it goes through the proxy. TCP by default,
|
||||
because ISP DPI often fakes UDP answers from well-known resolvers, which breaks zapret.
|
||||
'';
|
||||
example = {
|
||||
type = "tls";
|
||||
@@ -35,9 +34,8 @@ in
|
||||
type = t.dnsUpstreamType;
|
||||
default = cloudflare;
|
||||
description = ''
|
||||
Resolver used through the proxy; the DNS default when proxy.routing.default is proxy. On
|
||||
sing-box, names the routing sends through the proxy are always looked up here, so the ISP
|
||||
never sees them, and direct ones locally.
|
||||
Resolver reached through the proxy. On sing-box, proxied names are always resolved here,
|
||||
so the ISP never sees them. Also the default resolver when `proxy.routing.default` is "proxy".
|
||||
'';
|
||||
example = {
|
||||
type = "tls";
|
||||
@@ -56,7 +54,7 @@ in
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "Which addresses sing-box asks for. `ipv4_only` for an uplink without IPv6. sing-box and hybrid backends.";
|
||||
description = "Which IP versions to resolve. Use `ipv4_only` if the uplink has no IPv6. sing-box and hybrid only.";
|
||||
example = "ipv4_only";
|
||||
};
|
||||
|
||||
@@ -64,8 +62,8 @@ in
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
EDNS client subnet sent with every query, so a resolver reached through the proxy still
|
||||
answers with CDN nodes near this network. sing-box and hybrid backends.
|
||||
EDNS client subnet sent with every query, so CDNs pick servers near you even through the
|
||||
proxy. sing-box and hybrid only.
|
||||
'';
|
||||
example = "203.0.113.0/24";
|
||||
};
|
||||
@@ -75,19 +73,17 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
In TUN mode (global and per-app), answer A queries from the TUN with a fake address and
|
||||
AAAA ones with nothing; sing-box maps the address back to the name when the connection
|
||||
comes. Saves a lookup per new site and no real lookup leaves for proxied names. Names that
|
||||
proxy.dns.singBox.rules or the direct routing lists send elsewhere keep real answers. The
|
||||
addresses handed out are kept in /var/lib/proxy-suite/fakeip, so they survive a restart.
|
||||
sing-box and hybrid backends; XRay's TUN already uses its own fake DNS.
|
||||
Answer DNS in TUN mode with fake addresses that sing-box maps back to names. Saves a
|
||||
lookup per new site, and proxied names are never resolved locally. Direct names and those
|
||||
matched by `proxy.dns.singBox.rules` still get real answers. sing-box and hybrid only;
|
||||
XRay's TUN has its own fake DNS.
|
||||
'';
|
||||
};
|
||||
|
||||
inet4Range = mkOption {
|
||||
type = types.str;
|
||||
default = "198.18.0.0/15";
|
||||
description = "Range the fake addresses come from.";
|
||||
description = "Address range for fake IPs.";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -96,8 +92,8 @@ in
|
||||
type = types.listOf types.attrs;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Extra sing-box DNS servers, as sing-box JSON, for proxy.dns.singBox.rules to name. The
|
||||
built-in ones are `local`, `remote`, and `fakeip` when fakeIp is on.
|
||||
Extra DNS servers in sing-box JSON, for use in `proxy.dns.singBox.rules`. Built-in
|
||||
servers: `local`, `remote`, and `fakeip` when fake IP is on.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
@@ -112,8 +108,8 @@ in
|
||||
type = types.listOf types.attrs;
|
||||
default = [ ];
|
||||
description = ''
|
||||
sing-box DNS rules, as sing-box JSON, checked before the generated ones. Kept when the
|
||||
route mode is all-proxy or all-bypass, which drop the generated ones.
|
||||
DNS rules in sing-box JSON, checked before the generated ones. Unlike those, they stay
|
||||
active in the all-proxy and all-bypass modes.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
|
||||
@@ -10,8 +10,9 @@ in
|
||||
type = types.listOf t.outboundType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Static proxy outbounds. The proxy needs at least one outbound or subscription to start;
|
||||
`proxy-ctl proxy outbounds add` supplies one at runtime if none is declared here.
|
||||
Proxy servers to connect through. Each sets exactly one of `url`, `urlFile`, `singBoxJson`
|
||||
or `xrayJson`. The proxy needs at least one outbound or subscription to start;
|
||||
`proxy-ctl proxy outbounds add` can add one at runtime.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
@@ -29,9 +30,8 @@ in
|
||||
type = types.listOf t.subscriptionType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Subscription URLs serving a base64 or plain list of proxy URIs. Fetched on first start,
|
||||
cached under /var/lib/proxy-suite/subscriptions, refreshed by a timer. Ones added with
|
||||
`proxy-ctl proxy subs add` live in /var/lib/proxy-suite/subscriptions.d and refresh alongside.
|
||||
Subscription URLs that serve a list of proxy links (plain or base64). Fetched on first
|
||||
start, cached, and refreshed on a timer. `proxy-ctl proxy subs add` adds more at runtime.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
@@ -56,14 +56,13 @@ in
|
||||
];
|
||||
default = "first";
|
||||
description = ''
|
||||
How to pick among outbounds:
|
||||
- "first": one at a time - the pinned outbound, or the first available.
|
||||
- "selector": all of them, pick by hand.
|
||||
- "urltest": all of them, ranked by latency unless one is pinned.
|
||||
How to pick an outbound:
|
||||
- "first": the pinned one, or else the first available.
|
||||
- "selector": pick by hand.
|
||||
- "urltest": the fastest, unless one is pinned.
|
||||
|
||||
`proxy-ctl proxy pin` pins an outbound in every mode, and the pin outlives a restart.
|
||||
"selector" and "urltest" switch without restarting the backend (sing-box only); "first"
|
||||
and XRay restart it.
|
||||
`proxy-ctl proxy pin` works in every mode and survives restarts. On sing-box, "selector"
|
||||
and "urltest" switch without restarting the backend.
|
||||
'';
|
||||
example = "urltest";
|
||||
};
|
||||
@@ -72,10 +71,9 @@ in
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Outbound tags selection never picks on its own: hops other outbounds chain through
|
||||
(`detour`), or exits only routing rules name. Subscription entries, `warp`, `ssh-proxy`
|
||||
and AmneziaWG tags work too. A pin still reaches them, and so does a selector switched by
|
||||
hand.
|
||||
Outbound tags that selection never picks on its own, such as chain hops (`detour`) or
|
||||
exits meant only for routing rules. Any tag works, including subscription entries,
|
||||
`warp`, `ssh-proxy` and AmneziaWG. You can still pin or select them by hand.
|
||||
'';
|
||||
example = [
|
||||
"ru-vps"
|
||||
@@ -87,21 +85,21 @@ in
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
default = "https://www.gstatic.com/generate_204";
|
||||
description = "URL fetched through each outbound to rank them. Pick one blocked in your region.";
|
||||
description = "URL used to test outbounds. Pick one that is blocked in your region.";
|
||||
example = "https://telegram.org";
|
||||
};
|
||||
|
||||
interval = mkOption {
|
||||
type = types.str;
|
||||
default = "3m";
|
||||
description = "How often outbounds are re-tested (Go duration).";
|
||||
description = "How often outbounds are tested (Go duration).";
|
||||
example = "1m";
|
||||
};
|
||||
|
||||
tolerance = mkOption {
|
||||
type = types.int;
|
||||
default = 50;
|
||||
description = "Milliseconds a faster outbound must win by to replace the current one (sing-box only).";
|
||||
description = "How many milliseconds faster an outbound must be to replace the current one (sing-box only).";
|
||||
example = 100;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -13,48 +13,48 @@ in
|
||||
"direct"
|
||||
];
|
||||
default = "proxy";
|
||||
description = "Where traffic no routing rule matches goes.";
|
||||
description = "Where traffic goes when no rule matches.";
|
||||
example = "direct";
|
||||
};
|
||||
|
||||
directRu = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''Send geosite "category-ru" and geoip "ru" direct.'';
|
||||
description = ''Send Russian sites and IPs (geosite "category-ru", geoip "ru") direct.'';
|
||||
};
|
||||
|
||||
proxy = {
|
||||
domains = list "Domain suffixes sent through the proxy." [ "youtube.com" ];
|
||||
ips = list "IP CIDRs sent through the proxy." [ "1.1.1.0/24" ];
|
||||
geosites = list "Geosite names sent through the proxy." [ "netflix" ];
|
||||
geoips = list "Geoip names sent through the proxy." [ "us" ];
|
||||
ruleSets = list "Names from ruleSets sent through the proxy." [ "antifilter" ];
|
||||
domains = list "Domains, with their subdomains, sent through the proxy." [ "youtube.com" ];
|
||||
ips = list "IP ranges (CIDR) sent through the proxy." [ "1.1.1.0/24" ];
|
||||
geosites = list "Geosite categories sent through the proxy." [ "netflix" ];
|
||||
geoips = list "Geoip codes sent through the proxy." [ "us" ];
|
||||
ruleSets = list "Rule sets from `ruleSets` sent through the proxy." [ "antifilter" ];
|
||||
};
|
||||
|
||||
direct = {
|
||||
domains =
|
||||
list "Domain suffixes sent direct. zapret hostlists join them when zapret.directSync.enable is on."
|
||||
list "Domains, with their subdomains, sent direct. `zapret.directSync` adds zapret's domains."
|
||||
[
|
||||
"internal.example"
|
||||
];
|
||||
ips = list "IP CIDRs sent direct." [ "10.10.0.0/16" ];
|
||||
geosites = list "Geosite names sent direct." [ "category-ru" ];
|
||||
geoips = list "Geoip names sent direct." [ "ru" ];
|
||||
ruleSets = list "Names from ruleSets sent direct." [ "ru-services" ];
|
||||
ips = list "IP ranges (CIDR) sent direct." [ "10.10.0.0/16" ];
|
||||
geosites = list "Geosite categories sent direct." [ "category-ru" ];
|
||||
geoips = list "Geoip codes sent direct." [ "ru" ];
|
||||
ruleSets = list "Rule sets from `ruleSets` sent direct." [ "ru-services" ];
|
||||
};
|
||||
|
||||
block = {
|
||||
domains = list "Domain suffixes blocked." [ "ads.example.com" ];
|
||||
ips = list "IP CIDRs blocked." [ "203.0.113.0/24" ];
|
||||
geosites = list "Geosite names blocked." [ "category-ads-all" ];
|
||||
geoips = list "Geoip names blocked." [ "cn" ];
|
||||
ruleSets = list "Names from ruleSets blocked." [ "ads" ];
|
||||
domains = list "Domains, with their subdomains, to block." [ "ads.example.com" ];
|
||||
ips = list "IP ranges (CIDR) to block." [ "203.0.113.0/24" ];
|
||||
geosites = list "Geosite categories to block." [ "category-ads-all" ];
|
||||
geoips = list "Geoip codes to block." [ "cn" ];
|
||||
ruleSets = list "Rule sets from `ruleSets` to block." [ "ads" ];
|
||||
};
|
||||
|
||||
rules = mkOption {
|
||||
type = types.listOf t.routingRuleType;
|
||||
default = [ ];
|
||||
description = "Rules checked before the proxy/direct/block lists, in order; the first match wins.";
|
||||
description = "Rules checked in order before the proxy, direct and block lists. The first match wins.";
|
||||
example = [
|
||||
{
|
||||
outbound = "vps-de";
|
||||
@@ -73,7 +73,7 @@ in
|
||||
options = {
|
||||
url = mkOption {
|
||||
type = types.strMatching "https?://.+";
|
||||
description = "Where the sing-box rule set is downloaded from.";
|
||||
description = "URL of the sing-box rule set.";
|
||||
example = "https://example.com/antifilter.srs";
|
||||
};
|
||||
format = mkOption {
|
||||
@@ -84,7 +84,7 @@ in
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = ''"binary" (.srs) or "source" (JSON). Null goes by the URL: .srs is binary.'';
|
||||
description = ''"binary" (.srs) or "source" (JSON). `null`: guess from the URL.'';
|
||||
};
|
||||
detour = mkOption {
|
||||
type = types.enum [
|
||||
@@ -92,17 +92,16 @@ in
|
||||
"direct"
|
||||
];
|
||||
default = "proxy";
|
||||
description = "Downloaded through the local proxy, or directly.";
|
||||
description = "Download through the proxy or directly.";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = ''
|
||||
sing-box rule sets kept up to date at runtime, for the ruleSets of proxy, direct, block,
|
||||
rules and an outbound's routing. They are fetched every ruleSetUpdateInterval and on
|
||||
`proxy-ctl proxy rulesets update`, and sing-box picks up a new file without a restart;
|
||||
until the first fetch one matches nothing. Not for backend = "xray".
|
||||
Named sing-box rule sets, usable in any `ruleSets` list. They are downloaded every
|
||||
`ruleSetUpdateInterval` or on `proxy-ctl proxy rulesets update`, without a restart. A rule
|
||||
set matches nothing until its first download. Not available with the "xray" backend.
|
||||
'';
|
||||
example = {
|
||||
antifilter.url = "https://example.com/antifilter.srs";
|
||||
@@ -112,7 +111,7 @@ in
|
||||
ruleSetUpdateInterval = mkOption {
|
||||
type = types.str;
|
||||
default = "1d";
|
||||
description = "How often ruleSets are downloaded again (systemd time span).";
|
||||
description = "How often rule sets are refreshed (systemd time span).";
|
||||
example = "6h";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,36 +5,36 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxy.tproxy = {
|
||||
enable = mkEnableOption "global TProxy mode (proxy-suite-tproxy)";
|
||||
enable = mkEnableOption "global TProxy mode";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 1085;
|
||||
description = "Port of the TProxy inbound.";
|
||||
description = "Local port that intercepted traffic is redirected to.";
|
||||
};
|
||||
|
||||
fwmark = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = "Mark of intercepted packets, routed through routeTable.";
|
||||
description = "Firewall mark for intercepted packets.";
|
||||
};
|
||||
|
||||
proxyMark = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Mark of the backend's own traffic, so it is not intercepted again.";
|
||||
description = "Firewall mark for the proxy's own traffic, so it is not intercepted again.";
|
||||
};
|
||||
|
||||
routeTable = mkOption {
|
||||
type = types.int;
|
||||
default = 100;
|
||||
description = "Policy-routing table for intercepted traffic.";
|
||||
description = "Routing table for intercepted traffic.";
|
||||
};
|
||||
|
||||
localSubnets = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "192.168.0.0/16" ];
|
||||
description = "Subnets that bypass interception (DNS excepted): your LAN, VM bridges. IPv6 CIDRs work too.";
|
||||
description = "Subnets that skip the proxy, such as your LAN and VM bridges (DNS still goes through it). IPv6 works too.";
|
||||
example = [
|
||||
"192.168.0.0/16"
|
||||
"10.0.0.0/8"
|
||||
@@ -46,9 +46,9 @@ in
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Interfaces whose forwarded TCP and UDP is taken through the proxy too: devices on them
|
||||
that use this host as their gateway. Turns on IP forwarding for the rest (ping, the LAN
|
||||
itself), which is routed as it is. Needs the nftables firewall on NixOS.
|
||||
LAN interfaces whose devices use this host as their gateway. Their TCP and UDP goes through the
|
||||
proxy; everything else is forwarded as usual. Turns on IP forwarding. Needs the nftables
|
||||
firewall on NixOS.
|
||||
'';
|
||||
example = [ "br0" ];
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxy.tun = {
|
||||
enable = mkEnableOption "global TUN mode (proxy-suite-tun)";
|
||||
enable = mkEnableOption "global TUN mode";
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
|
||||
@@ -26,8 +26,7 @@ in
|
||||
];
|
||||
default = "sing-box";
|
||||
description = ''
|
||||
Proxy backend. "hybrid" runs sing-box in front and hands XRay-only outbounds
|
||||
(XHTTP, ECH) to XRay.
|
||||
Proxy engine. "hybrid" runs sing-box and hands XRay-only outbounds (XHTTP, ECH) to XRay.
|
||||
'';
|
||||
example = "hybrid";
|
||||
};
|
||||
@@ -41,8 +40,8 @@ in
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
Transparent mode started at boot, or null for neither. The mode named here must
|
||||
also be enabled (proxy.tun.enable or proxy.tproxy.enable).
|
||||
Transparent mode to start at boot, or `null` for none. That mode must also be enabled
|
||||
(`proxy.tun.enable` or `proxy.tproxy.enable`).
|
||||
'';
|
||||
example = "tun";
|
||||
};
|
||||
@@ -52,11 +51,9 @@ in
|
||||
default = config.services.proxy-suite.host.enableIPv6;
|
||||
defaultText = literalExpression "config.networking.enableIPv6";
|
||||
description = ''
|
||||
Carry IPv6 in the transparent modes: TProxy through a second listener on ::1, the TUNs
|
||||
(global and per-app) through an IPv6 address of their own. Off, TProxy leaves IPv6
|
||||
alone and the TUNs block it, so apps fall back to IPv4. On an uplink without IPv6,
|
||||
set proxy.dns.strategy = "ipv4_only" too: a direct IPv6 destination would otherwise
|
||||
fail after the connection seems open, instead of falling back to IPv4.
|
||||
Route IPv6 through TUN and TProxy too. When off, TProxy ignores IPv6 and the TUNs block
|
||||
it, so apps fall back to IPv4. If the uplink has no IPv6, also set
|
||||
`proxy.dns.strategy = "ipv4_only"`, or direct IPv6 connections hang instead of falling back.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -64,7 +61,7 @@ in
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
description = ''Bind address of the local SOCKS5/HTTP proxy. Use "0.0.0.0" only to expose it to the network.'';
|
||||
description = ''Address of the local SOCKS5/HTTP proxy. Use "0.0.0.0" only to expose it to the network.'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
@@ -77,14 +74,14 @@ in
|
||||
username = mkOption {
|
||||
type = types.nullOr (types.strMatching "[^[:space:]]+");
|
||||
default = null;
|
||||
description = "Username the local proxy requires. Set together with password or passwordFile.";
|
||||
description = "Username for the local proxy. Needs `password` or `passwordFile`.";
|
||||
example = "proxy-user";
|
||||
};
|
||||
|
||||
password = mkOption {
|
||||
type = types.nullOr (types.strMatching "[^[:space:]]+");
|
||||
default = null;
|
||||
description = "Inline local proxy password. Ends up in the Nix store; prefer passwordFile.";
|
||||
description = "Password for the local proxy. Ends up in the Nix store; prefer `passwordFile`.";
|
||||
example = "change-me";
|
||||
};
|
||||
|
||||
@@ -92,8 +89,8 @@ in
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the local proxy password. With perAppRouting.proxychains it must be a
|
||||
single token, and it is readable by userControl.group through the proxychains config.
|
||||
File with the local proxy password. With `perAppRouting.proxychains` it must be a single
|
||||
word, and `userControl.group` can read it through the proxychains config.
|
||||
'';
|
||||
example = "/run/secrets/proxy-suite-local-proxy-password";
|
||||
};
|
||||
@@ -103,32 +100,31 @@ in
|
||||
autoProxy = {
|
||||
enable = mkEnableOption "autoProxy" // {
|
||||
description = ''
|
||||
Probe each exit for the destinations clients dial, and route each one through the first
|
||||
exit that reaches it for as long as it keeps working (`proxy-ctl proxy auto probe` shows a
|
||||
verdict). Censor-side failures stay direct for zapret. Needs the sing-box backend, and
|
||||
makes this host fetch every new destination itself.
|
||||
Find out which destinations are blocked and route each one through the first exit that
|
||||
reaches it. Blocks that zapret can fix stay direct. Needs the sing-box backend. This host
|
||||
fetches every new destination itself to test it; `proxy-ctl proxy auto probe` shows the result.
|
||||
'';
|
||||
};
|
||||
|
||||
interval = mkOption {
|
||||
type = types.str;
|
||||
default = "10m";
|
||||
description = "Time between probe runs. `proxy-ctl proxy auto learn` does not wait for it.";
|
||||
description = "Time between probe runs. `proxy-ctl proxy auto learn` probes right away.";
|
||||
example = "30m";
|
||||
};
|
||||
|
||||
probesPerRun = mkOption {
|
||||
type = types.ints.positive;
|
||||
default = 200;
|
||||
description = "Most destinations probed per run; the rest wait in a backlog, most-dialled first.";
|
||||
description = "Maximum destinations probed per run. The rest wait for the next run, most-used first.";
|
||||
};
|
||||
|
||||
maxExits = mkOption {
|
||||
type = types.ints.positive;
|
||||
default = 12;
|
||||
description = ''
|
||||
Most exits probed, direct included. The first round tries one exit per network (AS), a
|
||||
second round the rest.
|
||||
Maximum exits tried per destination, direct included. One exit per network is tried
|
||||
first, then the rest.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -136,9 +132,8 @@ in
|
||||
type = types.ints.positive;
|
||||
default = 30;
|
||||
description = ''
|
||||
Days a verdict stands, routed destinations included: a route is re-probed once this long
|
||||
has passed. Everything is relearned when this host's public address changes, and
|
||||
`proxy-ctl proxy auto learn <domain>` re-probes one destination right away.
|
||||
Days before a result is probed again. Everything is probed again when this host's public
|
||||
address changes.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -146,8 +141,8 @@ in
|
||||
type = types.ints.unsigned;
|
||||
default = 150;
|
||||
description = ''
|
||||
Also route destinations that work directly but crawl: at least 300 KiB in a 10 s sample,
|
||||
never faster than this. 0 disables. Needs `selection` other than "first".
|
||||
Also route destinations that work directly but stay slower than this, in KiB/s. 0 disables.
|
||||
Needs `selection` other than "first".
|
||||
'';
|
||||
example = 0;
|
||||
};
|
||||
@@ -155,7 +150,7 @@ in
|
||||
exclude = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Domain suffixes never probed or auto-routed.";
|
||||
description = "Domains (with subdomains) never probed or routed by autoProxy.";
|
||||
example = [ "internal.example" ];
|
||||
};
|
||||
|
||||
@@ -163,8 +158,8 @@ in
|
||||
type = types.port;
|
||||
default = 18540;
|
||||
description = ''
|
||||
First loopback port of the per-exit probe listeners (one per exit, maxExits in total).
|
||||
They are unauthenticated even when proxy.listener.auth is set.
|
||||
First of `maxExits` loopback ports used for probing, one per exit. They have no
|
||||
authentication, even with `proxy.listener.auth` set.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@@ -175,13 +170,13 @@ in
|
||||
default = proxySuiteUpstream.sing-box;
|
||||
defaultText = literalMD "`sing-box` from proxy-suite's own `nixpkgs` input";
|
||||
example = literalExpression "pkgs.sing-box";
|
||||
description = ''sing-box package, used when backend is "sing-box" or "hybrid".'';
|
||||
description = ''sing-box package, for the "sing-box" and "hybrid" backends.'';
|
||||
};
|
||||
|
||||
clashApiPort = mkOption {
|
||||
type = types.port;
|
||||
default = 9090;
|
||||
description = "Loopback port of sing-box's Clash API, which switches and tests outbounds.";
|
||||
description = "Loopback port of the sing-box Clash API, used to switch and test outbounds.";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -191,7 +186,7 @@ in
|
||||
default = proxySuiteUpstream.xray;
|
||||
defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)";
|
||||
example = literalExpression "pkgs.xray";
|
||||
description = ''XRay package, used when backend is "xray" or "hybrid".'';
|
||||
description = ''XRay package, for the "xray" and "hybrid" backends.'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.sshProxy = {
|
||||
enable = mkEnableOption "an SSH dynamic SOCKS5 tunnel";
|
||||
enable = mkEnableOption "an SSH SOCKS5 tunnel";
|
||||
|
||||
# Where the tunnel goes.
|
||||
server = {
|
||||
@@ -36,24 +36,25 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Add the tunnel as an outbound tagged "ssh-proxy". sing-box dials SSH itself; XRay goes
|
||||
through the OpenSSH unit's SOCKS listener.
|
||||
Add the tunnel as an outbound tagged "ssh-proxy". On sing-box and hybrid, sing-box connects
|
||||
over SSH itself and needs `hostKey` or `hostKeyFile`. Otherwise OpenSSH runs a SOCKS listener, set up
|
||||
by `listener`, `knownHostsFile`, `strictHostKeyChecking`, `serviceUser` and `extraArgs`.
|
||||
'';
|
||||
};
|
||||
|
||||
identityFile = path "Runtime path to the private key; it may stay root-only, as the daemons get a copy they can read. Null uses the agent or OpenSSH defaults." "/run/secrets/proxy-suite-ssh-key";
|
||||
identityFile = path "File with the SSH private key. It can stay root-only. `null`: the agent or OpenSSH defaults." "/run/secrets/proxy-suite-ssh-key";
|
||||
|
||||
hostKey = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Accepted host keys (sing-box). List every key `ssh-keyscan` prints: the algorithm is
|
||||
negotiated. Empty accepts any key.
|
||||
Accepted host keys, for sing-box. List every key `ssh-keyscan` prints, since the key type
|
||||
is negotiated.
|
||||
'';
|
||||
example = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ];
|
||||
};
|
||||
|
||||
hostKeyFile = path "Known-hosts file to read hostKey from at runtime (sing-box). Wins over hostKey." "/root/.ssh/known_hosts";
|
||||
hostKeyFile = path "Known-hosts file to read host keys from (sing-box). Takes priority over `hostKey`." "/root/.ssh/known_hosts";
|
||||
|
||||
# The rest only apply to the OpenSSH unit (XRay, or asOutbound = false).
|
||||
knownHostsFile = path "Known-hosts file for OpenSSH." "/run/secrets/proxy-suite-ssh-known-hosts";
|
||||
@@ -87,7 +88,7 @@ in
|
||||
serviceUser = mkOption {
|
||||
type = token;
|
||||
default = "proxy-suite-daemon";
|
||||
description = "Unix user running the OpenSSH unit. The default, proxy-suite-daemon, runs sandboxed and keeps accepted host keys in /var/lib/proxy-suite/ssh; null runs it as root.";
|
||||
description = "User that runs OpenSSH. The default is sandboxed; `null` runs it as root.";
|
||||
example = "proxy";
|
||||
};
|
||||
|
||||
@@ -111,7 +112,7 @@ in
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "Resolve destinations locally before the tunnel (XRay only). Can break geo-steered CDNs.";
|
||||
description = "Resolve names locally instead of on the server (XRay only). Can make CDNs pick distant servers.";
|
||||
example = "prefer_ipv4";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,40 +6,40 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.tgWsProxy = {
|
||||
enable = mkEnableOption "the Telegram MTProto WebSocket proxy";
|
||||
enable = mkEnableOption "the Telegram WebSocket proxy (MTProto)";
|
||||
|
||||
listener = {
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Bind address.";
|
||||
description = "Listening address.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 1443;
|
||||
description = "Listen port.";
|
||||
description = "Listening port.";
|
||||
};
|
||||
};
|
||||
|
||||
secret = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Inline MTProto secret (`openssl rand -hex 16`). Ends up in the Nix store; prefer secretFile.";
|
||||
description = "MTProto secret (`openssl rand -hex 16`). Ends up in the Nix store; prefer `secretFile`.";
|
||||
example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
||||
};
|
||||
|
||||
secretFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Runtime path to the MTProto secret.";
|
||||
description = "File with the MTProto secret.";
|
||||
example = "/run/secrets/tg-ws-proxy-secret";
|
||||
};
|
||||
|
||||
dcIps = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = "Relay IP per Telegram DC ID.";
|
||||
description = "Relay IP for each Telegram DC ID.";
|
||||
example = {
|
||||
"2" = "149.154.167.220";
|
||||
};
|
||||
@@ -48,25 +48,25 @@ in
|
||||
fakeTlsDomain = mkOption {
|
||||
type = types.nullOr (types.strMatching ".+");
|
||||
default = null;
|
||||
description = "SNI for Fake TLS masking (ee-secret links).";
|
||||
description = "Domain to disguise traffic as, with Fake TLS (ee-secret links).";
|
||||
example = "www.example.com";
|
||||
};
|
||||
|
||||
cloudflare = {
|
||||
domains = domains "Cloudflare-proxied domains for WebSocket fallback." [ "cdn.example.com" ];
|
||||
domains = domains "Domains behind Cloudflare to fall back to." [ "cdn.example.com" ];
|
||||
workerDomains = domains "Cloudflare Worker domains, tried first." [ "worker.example.com" ];
|
||||
|
||||
fallback = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Fall back to Cloudflare when direct WebSocket fails.";
|
||||
description = "Fall back to Cloudflare when a direct WebSocket fails.";
|
||||
};
|
||||
};
|
||||
|
||||
poolSize = mkOption {
|
||||
type = types.ints.unsigned;
|
||||
default = 4;
|
||||
description = "WebSocket pool size per DC; 0 disables pooling.";
|
||||
description = "Idle WebSockets kept open per DC. 0 disables.";
|
||||
};
|
||||
|
||||
bufferKiB = mkOption {
|
||||
@@ -78,45 +78,45 @@ in
|
||||
proxyProtocol = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Accept a PROXY protocol v1 header from a fronting reverse proxy.";
|
||||
description = "Accept a PROXY protocol v1 header from a reverse proxy in front.";
|
||||
};
|
||||
|
||||
bypassTransparentProxy = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Keep the relay's own connections out of TUN/TProxy, which would otherwise loop them.";
|
||||
description = "Keep the relay's own connections out of TUN and TProxy, so they do not loop.";
|
||||
};
|
||||
|
||||
fwmark = mkOption {
|
||||
type = types.int;
|
||||
default = 4;
|
||||
description = "Packet mark bypassTransparentProxy uses.";
|
||||
description = "Firewall mark for `bypassTransparentProxy`.";
|
||||
};
|
||||
|
||||
log = {
|
||||
verbose = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Debug logging.";
|
||||
description = "Log debug messages.";
|
||||
};
|
||||
|
||||
file = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Rotating log file, written as the proxy-suite-daemon user; /var/log/proxy-suite-tg-ws-proxy is created for it. Null logs to stderr.";
|
||||
description = "Log file, rotated. `null`: log to the journal.";
|
||||
example = "/var/log/proxy-suite-tg-ws-proxy/tg-ws-proxy.log";
|
||||
};
|
||||
|
||||
maxSizeMiB = mkOption {
|
||||
type = types.numbers.positive;
|
||||
default = 5.0;
|
||||
description = "Log size before rotation, in MiB.";
|
||||
description = "Rotate the log at this size, in MiB.";
|
||||
};
|
||||
|
||||
keep = mkOption {
|
||||
type = types.ints.positive;
|
||||
default = 1;
|
||||
description = "Rotated logs kept.";
|
||||
description = "Number of rotated logs to keep.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,21 +18,23 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.tor = {
|
||||
enable = mkEnableOption "the Tor daemon (proxy-suite-tor)";
|
||||
enable = mkEnableOption "Tor" // {
|
||||
description = "Run Tor. Also turn on `asOutbound`, `onionService.enable`, or both.";
|
||||
};
|
||||
|
||||
package = package "tor" "Tor package.";
|
||||
|
||||
lyrebirdPackage = package "lyrebird" "Pluggable transport for obfs4, webtunnel and meek_lite bridges.";
|
||||
lyrebirdPackage = package "lyrebird" "Bridge transport for obfs4, webtunnel and meek_lite.";
|
||||
|
||||
snowflakePackage = package "snowflake" "Pluggable transport for snowflake bridges.";
|
||||
snowflakePackage = package "snowflake" "Bridge transport for snowflake.";
|
||||
|
||||
asOutbound = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Add Tor as an outbound tagged "tor": a SOCKS hop to proxy-suite-tor on 127.0.0.1:socksPort,
|
||||
which receives names unresolved. proxy.selection and autoProxy leave it alone unless it is the
|
||||
only outbound; route to it with proxy.routing.rules or name it as a detour. Requires proxy.enable.
|
||||
Add Tor as an outbound tagged "tor". Selection and autoProxy skip it unless it is the only
|
||||
outbound; send traffic to it with `proxy.routing.rules` or use it as a `detour`.
|
||||
Needs `proxy.enable`.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -40,10 +42,8 @@ in
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Send .onion names to the "tor" outbound in every route mode, and keep them away from DNS:
|
||||
in TUN and TProxy modes sing-box answers them with a fake address it maps back to the name,
|
||||
and XRay drops the lookup. Inbound clients' .onion names go the same way, through the local
|
||||
proxy, whatever their listener's via (except "block"). Applies with asOutbound.
|
||||
Send .onion names to the "tor" outbound in every route mode, and never resolve them with
|
||||
DNS. Inbound clients' .onion names go there too. Needs `asOutbound`.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -51,9 +51,8 @@ in
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Keep Tor a client (ClientOnly 1): never a relay, exit, bridge or directory server, even when
|
||||
extraConfig sets an ORPort. The onion service works either way. Turn off only to run a relay
|
||||
through extraConfig.
|
||||
Keep Tor a client, never a relay, even if `extraConfig` sets an ORPort. The onion service
|
||||
works either way. Turn off only to run a relay through `extraConfig`.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -64,17 +63,17 @@ in
|
||||
];
|
||||
default = "direct";
|
||||
description = ''
|
||||
How Tor reaches its relays or bridges.
|
||||
- "direct": from the uplink, past TUN and TProxy (it runs as proxy-suite-daemon).
|
||||
- "proxy": through the local proxy listener (proxy.listener, with its auth), for a network
|
||||
that blocks Tor. obfs4, webtunnel and meek_lite bridges follow it; snowflake cannot.
|
||||
How Tor reaches the network.
|
||||
- "direct": straight from the uplink, bypassing TUN and TProxy.
|
||||
- "proxy": through the local proxy, for networks that block Tor. Works with obfs4,
|
||||
webtunnel and meek_lite bridges, but not snowflake.
|
||||
'';
|
||||
};
|
||||
|
||||
socksPort = mkOption {
|
||||
type = types.port;
|
||||
default = 18530;
|
||||
description = "Loopback SOCKS port of proxy-suite-tor, which the tor outbound dials.";
|
||||
description = "Loopback SOCKS port of Tor.";
|
||||
};
|
||||
|
||||
bridges = {
|
||||
@@ -82,9 +81,8 @@ in
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Bridge lines, as https://bridges.torproject.org hands them out, without the leading
|
||||
"Bridge". Any given turns on UseBridges; obfs4, webtunnel, meek_lite and snowflake
|
||||
transports are run as needed.
|
||||
Bridge lines from https://bridges.torproject.org, without the leading "Bridge". Setting
|
||||
any turns bridges on.
|
||||
'';
|
||||
example = [
|
||||
"obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=... iat-mode=0"
|
||||
@@ -94,24 +92,23 @@ in
|
||||
file = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Runtime path to more bridge lines, one per line; blank lines and # comments are skipped.";
|
||||
description = "File with more bridge lines, one per line. Blank lines and # comments are skipped.";
|
||||
example = "/run/secrets/tor-bridges";
|
||||
};
|
||||
};
|
||||
|
||||
onionService = {
|
||||
enable = mkEnableOption "an onion service in front of inbounds.listeners";
|
||||
enable = mkEnableOption "an onion service for the server inbounds";
|
||||
|
||||
listeners = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
inbounds.listeners served at the onion address, each on its share port. Null takes every
|
||||
listener a TCP-only onion can carry: not amneziawg, h3-only xhttp or raw JSON.
|
||||
Listeners reachable through the onion address. `null`: every TCP listener (not
|
||||
amneziawg, h3-only xhttp or raw JSON).
|
||||
|
||||
Share links for them (`proxy-ctl inbounds link TAG --onion`, and subscriptions) dial the
|
||||
.onion address and keep the listener's TLS and REALITY names. Clients reach XRay from
|
||||
127.0.0.1, so `proxy-ctl inbounds online` does not list them.
|
||||
Get their links with `proxy-ctl inbounds link TAG --onion`; subscriptions include them.
|
||||
Onion clients do not show up in `proxy-ctl inbounds online`.
|
||||
'';
|
||||
example = [ "vless-reality" ];
|
||||
};
|
||||
@@ -120,8 +117,7 @@ in
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to an hs_ed25519_secret_key, to keep an onion address. Null lets Tor create
|
||||
one in /var/lib/proxy-suite/tor/onion.
|
||||
File with an hs_ed25519_secret_key, to keep a fixed onion address. `null`: Tor creates one.
|
||||
'';
|
||||
example = "/run/secrets/tor-hs_ed25519_secret_key";
|
||||
};
|
||||
@@ -130,7 +126,7 @@ in
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Lines appended to the generated torrc.";
|
||||
description = "Extra torrc lines.";
|
||||
example = ''
|
||||
ExitNodes {de},{nl}
|
||||
StrictNodes 1
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.services.proxy-suite.tui.enable =
|
||||
lib.mkEnableOption "proxy-tui, an interactive terminal UI for everything proxy-ctl controls at runtime"
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
options.services.proxy-suite.tui.enable = lib.mkEnableOption "proxy-tui, a terminal UI" // {
|
||||
default = true;
|
||||
};
|
||||
}
|
||||
@@ -4,28 +4,32 @@ let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (import ./lib.nix { inherit lib; }) list;
|
||||
|
||||
routingFields = {
|
||||
domains = list "Domain suffixes to match." [ "youtube.com" ];
|
||||
ips = list "IP CIDRs to match." [ "1.1.1.0/24" ];
|
||||
geosites = list "Geosite names to match (see geodata)." [ "netflix" ];
|
||||
geoips = list "Geoip names to match (see geodata; the defaults are country codes only)." [ "us" ];
|
||||
# `what` ends each description, saying where the matches go.
|
||||
routingFields = what: {
|
||||
domains = list "Domains, with their subdomains, ${what}." [ "youtube.com" ];
|
||||
ips = list "IP ranges (CIDR) ${what}." [ "1.1.1.0/24" ];
|
||||
geosites = list "Geosite categories ${what} (see `geodata`)." [ "netflix" ];
|
||||
geoips = list "Geoip codes ${what}; countries by default (see `geodata`)." [ "us" ];
|
||||
};
|
||||
# The client's routing also matches downloaded rule sets, which XRay cannot read.
|
||||
clientRoutingFields = routingFields // {
|
||||
ruleSets = list "Names from proxy.routing.ruleSets to match (sing-box and hybrid backends)." [
|
||||
"antifilter"
|
||||
];
|
||||
};
|
||||
clientRoutingFields =
|
||||
what:
|
||||
routingFields what
|
||||
// {
|
||||
ruleSets = list "Rule sets from `proxy.routing.ruleSets` ${what} (sing-box and hybrid only)." [
|
||||
"antifilter"
|
||||
];
|
||||
};
|
||||
|
||||
routingRuleType = types.submodule {
|
||||
options = {
|
||||
outbound = mkOption {
|
||||
type = types.str;
|
||||
description = ''Outbound tag, or "proxy", "direct", "block".'';
|
||||
description = ''Outbound tag, or "proxy", "direct" or "block".'';
|
||||
example = "vps-de";
|
||||
};
|
||||
}
|
||||
// clientRoutingFields;
|
||||
// clientRoutingFields "that this rule matches";
|
||||
};
|
||||
|
||||
dnsUpstreamType = types.submodule {
|
||||
@@ -58,7 +62,7 @@ let
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.strMatching "^[a-z0-9][a-z0-9-]*$";
|
||||
description = "Profile name, unique.";
|
||||
description = "Unique profile name.";
|
||||
example = "steam-browser";
|
||||
};
|
||||
|
||||
@@ -72,8 +76,8 @@ let
|
||||
];
|
||||
default = "proxychains";
|
||||
description = ''
|
||||
Backend: "direct" (unchanged), "proxychains", or the per-app "tun", "tproxy" or "zapret"
|
||||
backend of perAppRouting.
|
||||
How the app is routed: "direct" (untouched), "proxychains", or the per-app "tun",
|
||||
"tproxy" or "zapret".
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -16,21 +16,21 @@ let
|
||||
options = {
|
||||
publicKey = mkOption {
|
||||
type = types.strMatching "[^[:space:]]+";
|
||||
description = "AmneziaWG peer public key.";
|
||||
description = "Peer public key.";
|
||||
};
|
||||
presharedKey = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Inline peer preshared key. Prefer presharedKeyFile for secrets.";
|
||||
description = "Peer preshared key. Ends up in the Nix store; prefer `presharedKeyFile`.";
|
||||
};
|
||||
presharedKeyFile = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Runtime path containing the peer preshared key.";
|
||||
description = "File with the peer preshared key.";
|
||||
};
|
||||
allowedIPs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "IP prefixes routed to and accepted from this peer.";
|
||||
description = "IP ranges routed to and accepted from this peer.";
|
||||
example = [
|
||||
"0.0.0.0/0"
|
||||
"::/0"
|
||||
@@ -40,17 +40,17 @@ let
|
||||
type = optionalString;
|
||||
default = null;
|
||||
example = "vpn.example.com:51820";
|
||||
description = "Optional peer endpoint in host:port form.";
|
||||
description = "Peer address, as host:port.";
|
||||
};
|
||||
persistentKeepalive = mkOption {
|
||||
type = optionalRange;
|
||||
default = null;
|
||||
description = "Persistent keepalive seconds, optionally expressed as an AWG 3 range.";
|
||||
description = "Keepalive interval in seconds, or an AWG 3 range.";
|
||||
};
|
||||
advancedSecurity = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = "Optional AWG peer AdvancedSecurity setting.";
|
||||
description = "AWG AdvancedSecurity setting.";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -92,8 +92,8 @@ let
|
||||
i3 = "Third custom signature packet (I3).";
|
||||
i4 = "Fourth custom signature packet (I4).";
|
||||
i5 = "Fifth custom signature packet (I5).";
|
||||
headerProtectionKey = "Inline AWG 3 header-protection key. Prefer headerProtectionKeyFile.";
|
||||
headerProtectionKeyFile = "Runtime path containing the AWG 3 header-protection key.";
|
||||
headerProtectionKey = "AWG 3 header-protection key. Ends up in the Nix store; prefer `headerProtectionKeyFile`.";
|
||||
headerProtectionKeyFile = "File with the AWG 3 header-protection key.";
|
||||
}
|
||||
// lib.mapAttrs (_: optional (types.nullOr types.bool)) {
|
||||
randomTrailers = "AWG 3 random transport trailers (RandomTrailers).";
|
||||
@@ -106,38 +106,38 @@ let
|
||||
addresses = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "IP prefixes assigned to the AWG interface.";
|
||||
description = "Interface addresses.";
|
||||
example = [ "10.8.0.2/32" ];
|
||||
};
|
||||
dns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "DNS servers installed while this profile is active.";
|
||||
description = "DNS servers used while this profile is active.";
|
||||
};
|
||||
privateKey = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Inline client private key. Prefer privateKeyFile.";
|
||||
description = "Client private key. Ends up in the Nix store; prefer `privateKeyFile`.";
|
||||
};
|
||||
privateKeyFile = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Runtime path containing the client private key.";
|
||||
description = "File with the client private key.";
|
||||
};
|
||||
listenPort = mkOption {
|
||||
type = types.nullOr types.port;
|
||||
default = null;
|
||||
description = "Optional local UDP listen port.";
|
||||
description = "Local UDP port.";
|
||||
};
|
||||
mtu = mkOption {
|
||||
type = optionalUnsigned;
|
||||
default = null;
|
||||
description = "Optional interface MTU.";
|
||||
description = "Interface MTU.";
|
||||
};
|
||||
table = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "wg-quick routing table name/number, auto, or off.";
|
||||
description = "Routing table: a name or number, \"auto\" or \"off\".";
|
||||
};
|
||||
obfuscation = mkOption {
|
||||
type = obfuscationType;
|
||||
@@ -149,14 +149,10 @@ let
|
||||
default = null;
|
||||
example = "/run/secrets/awg-obfuscation.json";
|
||||
description = ''
|
||||
Runtime path to a partial JSON object using the same field names and
|
||||
value types as obfuscation, excluding headerProtectionKeyFile.
|
||||
Values are combined with public obfuscation settings at service startup
|
||||
without putting the file contents in the Nix store. Omitted or null
|
||||
fields are unset; duplicate JSON keys and fields set in both sources
|
||||
are rejected. A file-provided headerProtectionKey also conflicts with
|
||||
obfuscation.headerProtectionKeyFile. Private and preshared keys use
|
||||
their existing file options. Restart the profile after secret rotation.
|
||||
File with secret obfuscation settings as JSON, using the same fields as `obfuscation`
|
||||
(except `headerProtectionKeyFile`). It is merged with `obfuscation` at startup and never
|
||||
enters the Nix store. A field set in both places is an error. Restart the profile after
|
||||
changing the file.
|
||||
'';
|
||||
};
|
||||
peers = mkOption {
|
||||
@@ -174,12 +170,12 @@ let
|
||||
interfaceName = mkOption {
|
||||
type = types.strMatching "^[A-Za-z0-9_.-]{1,15}$";
|
||||
default = "awg-${name}";
|
||||
description = "Linux interface name. It must fit Linux's 15-character limit.";
|
||||
description = "Interface name, at most 15 characters.";
|
||||
};
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to start this profile at boot. At most one profile may autostart.";
|
||||
description = "Start this profile at boot. Only one profile can autostart.";
|
||||
};
|
||||
asOutbound = mkOption {
|
||||
type = types.nullOr (
|
||||
@@ -191,52 +187,46 @@ let
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
Make the profile a proxy outbound tagged with its name instead of a global profile. It then
|
||||
always runs, leaves the host's routes and resolver alone, and is not listed by
|
||||
`proxy-ctl awg`. Requires proxy.enable.
|
||||
- "singBox": a WireGuard endpoint in its own sing-box process, reached as a loopback SOCKS
|
||||
hop. sing-box speaks plain WireGuard: AmneziaWG obfuscation is dropped with a warning.
|
||||
- "userspace": the same hop served by wireproxy on AmneziaWG's userspace implementation, so
|
||||
obfuscation works. It needs no interface or root: the only AmneziaWG mode on
|
||||
home-manager and nix-on-droid. A declared or profile ListenPort is used as is. An
|
||||
Endpoint hostname resolves through the system resolver: give an address where that
|
||||
resolver cannot reach the name.
|
||||
- "interface": the AmneziaWG interface comes up without routes (Table = off), and the
|
||||
outbound binds to it, so obfuscation works. With the sing-box backend its DNS goes
|
||||
through the interface too (proxy.dns.remote); XRay resolves as usual.
|
||||
Either way the tunnel itself reaches the peer over the uplink, past TUN and TProxy.
|
||||
Use the profile as a proxy outbound, tagged with its name, instead of a global VPN. It
|
||||
then always runs and leaves the host's routes and DNS alone. Needs `proxy.enable`.
|
||||
- "singBox": plain WireGuard in sing-box. AmneziaWG obfuscation is dropped, with a warning.
|
||||
- "userspace": wireproxy with AmneziaWG obfuscation. Needs no root, so it is the only
|
||||
mode on home-manager and Nix-on-Droid. Its endpoint is resolved by the system
|
||||
resolver, so use an IP if that resolver cannot reach the name.
|
||||
- "interface": a real AmneziaWG interface without routes, which the outbound binds to.
|
||||
On sing-box, its DNS also goes through the tunnel.
|
||||
'';
|
||||
};
|
||||
endpoint = endpoint "host:port (IPv6 in brackets) that replaces the first peer's Endpoint when the profile is prepared.";
|
||||
endpoint = endpoint "host:port (IPv6 in brackets) that replaces the first peer's endpoint.";
|
||||
allowConfigHooks = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Allow trusted imported configs to execute wg-quick hooks or use SaveConfig.";
|
||||
description = "Let imported configs run wg-quick hooks (PostUp etc.) or use SaveConfig. Only for trusted configs.";
|
||||
};
|
||||
vpnContainer = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "AWG container/protocol identifier to select when a vpn:// bundle is ambiguous.";
|
||||
description = "Which container to take from a vpn:// export that holds several.";
|
||||
};
|
||||
configFile = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Runtime path to an AmneziaWG .conf file.";
|
||||
description = "File with an AmneziaWG .conf.";
|
||||
};
|
||||
vpnFile = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Runtime path containing a self-contained vpn:// export.";
|
||||
description = "File with a vpn:// export.";
|
||||
};
|
||||
vpn = mkOption {
|
||||
type = optionalString;
|
||||
default = null;
|
||||
description = "Inline self-contained vpn:// export. This value is stored in the Nix store.";
|
||||
description = "A vpn:// export. Ends up in the Nix store; prefer `vpnFile`.";
|
||||
};
|
||||
settings = mkOption {
|
||||
type = types.nullOr settingsType;
|
||||
default = null;
|
||||
description = "Typed declarative AmneziaWG client configuration.";
|
||||
description = "The client config written in Nix, instead of a file.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,23 +10,23 @@ let
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Account label: the share link's name, and what subscriptions and stats group by.";
|
||||
description = "User name, shown in share links, subscriptions and stats.";
|
||||
example = "phone";
|
||||
};
|
||||
uuid = nullStr "UUID (vless, vmess). Ends up in the Nix store; prefer uuidFile." "b831381d-6324-4d53-ad4f-8cda48b30811";
|
||||
uuidFile = nullStr "Runtime path to the UUID." "/run/secrets/proxy-inbound-uuid";
|
||||
password = nullStr "Password (trojan, shadowsocks, socks, http). Ends up in the Nix store; prefer passwordFile." "hunter2";
|
||||
passwordFile = nullStr "Runtime path to the password." "/run/secrets/proxy-inbound-password";
|
||||
uuid = nullStr "UUID (vless, vmess). Ends up in the Nix store; prefer `uuidFile`." "b831381d-6324-4d53-ad4f-8cda48b30811";
|
||||
uuidFile = nullStr "File with the UUID." "/run/secrets/proxy-inbound-uuid";
|
||||
password = nullStr "Password (trojan, shadowsocks, socks, http). Ends up in the Nix store; prefer `passwordFile`." "hunter2";
|
||||
passwordFile = nullStr "File with the password." "/run/secrets/proxy-inbound-password";
|
||||
|
||||
publicKey = nullStr ''
|
||||
AmneziaWG public key of a peer that keeps its private key to itself. It gets no client
|
||||
config or link. Null generates a key pair, kept in the state directory.
|
||||
AmneziaWG public key, for a client that keeps its own private key (no config or link is
|
||||
generated for it). `null`: generate a key pair.
|
||||
'' "jNXH...";
|
||||
privateKeyFile = nullStr "Runtime path to the AmneziaWG client private key, instead of a generated one." "/run/secrets/awg-phone-key";
|
||||
presharedKeyFile = nullStr "Runtime path to the AmneziaWG preshared key, instead of a generated one." "/run/secrets/awg-phone-psk";
|
||||
privateKeyFile = nullStr "File with the AmneziaWG client private key, instead of a generated one." "/run/secrets/awg-phone-key";
|
||||
presharedKeyFile = nullStr "File with the AmneziaWG preshared key, instead of a generated one." "/run/secrets/awg-phone-psk";
|
||||
address = nullStr ''
|
||||
AmneziaWG tunnel IPv4 address, inside amneziaWg.subnet. Null takes the lowest free one, which
|
||||
the user keeps for as long as it exists.
|
||||
AmneziaWG tunnel IPv4 address, inside `amneziaWg.subnet`. `null`: the lowest free one,
|
||||
kept for as long as the user exists.
|
||||
'' "10.66.0.10";
|
||||
};
|
||||
};
|
||||
@@ -43,11 +43,10 @@ let
|
||||
];
|
||||
default = "proxy";
|
||||
description = ''
|
||||
What clients reach besides the internet, which they reach the listener's `via` way either way:
|
||||
- "proxy": nothing else. This host, its private networks and the other peers are cut off.
|
||||
- "lan": also this host, its private networks and the other peers, directly (masqueraded
|
||||
behind this host), not through `via`. It turns on IP forwarding.
|
||||
Only TCP and UDP can follow `via`: anything else to the internet (ping) is dropped.
|
||||
What clients can reach besides the internet, which always goes through the listener's `via`:
|
||||
- "proxy": nothing else. This host, its LAN and other peers are cut off.
|
||||
- "lan": also this host, its LAN and other peers, directly. Turns on IP forwarding.
|
||||
Only TCP and UDP reach the internet; ping and other protocols are dropped.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -55,31 +54,31 @@ let
|
||||
type = types.strMatching "^[A-Za-z0-9_.-]+$";
|
||||
default = "awgi-${tag}";
|
||||
defaultText = lib.literalExpression ''"awgi-<tag>"'';
|
||||
description = "Linux interface name. It must fit Linux's 15-character limit.";
|
||||
description = "Interface name, at most 15 characters.";
|
||||
};
|
||||
|
||||
subnet = mkOption {
|
||||
type = types.strMatching "[0-9.]+/[0-9]+";
|
||||
default = "10.66.0.0/24";
|
||||
description = ''
|
||||
Tunnel IPv4 subnet, private and unused elsewhere. This host takes the first address, clients
|
||||
the rest.
|
||||
Tunnel IPv4 subnet, private and unused elsewhere. This host takes the first address,
|
||||
clients the rest.
|
||||
'';
|
||||
};
|
||||
|
||||
subnet6 = nullStr ''
|
||||
Tunnel IPv6 subnet (ULA), laid out as subnet. Null keeps the tunnel IPv4-only. With mode = "lan"
|
||||
it turns on IPv6 forwarding, which stops this host configuring itself from router advertisements.
|
||||
Tunnel IPv6 subnet (ULA). `null`: IPv4 only. With `mode = "lan"` it turns on IPv6
|
||||
forwarding, which stops this host from configuring itself from router advertisements.
|
||||
'' "fd66:66::/64";
|
||||
|
||||
privateKeyFile = nullStr "Runtime path to the server private key, instead of a generated one." "/run/secrets/awg-server-key";
|
||||
privateKeyFile = nullStr "File with the server private key, instead of a generated one." "/run/secrets/awg-server-key";
|
||||
|
||||
obfuscation = mkOption {
|
||||
type = obfuscationType;
|
||||
default = { };
|
||||
description = ''
|
||||
Obfuscation parameters, shared with every client. Jc, Jmin, Jmax, S1, S2 and H1-H4 left
|
||||
null are generated once and kept in the state directory; the rest stay unset.
|
||||
Obfuscation parameters, shared with every client. Jc, Jmin, Jmax, S1, S2 and H1-H4 are
|
||||
generated once if left `null`; the rest stay unset.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -89,19 +88,19 @@ let
|
||||
"1.1.1.1"
|
||||
"1.0.0.1"
|
||||
];
|
||||
description = "DNS servers in client configs. Queries leave like any other traffic.";
|
||||
description = "DNS servers in client configs. Queries exit like any other traffic.";
|
||||
};
|
||||
|
||||
mtu = mkOption {
|
||||
type = types.nullOr types.ints.unsigned;
|
||||
default = null;
|
||||
description = "Interface MTU, on both ends. Null leaves awg-quick's (1280 with AWG 3 fields).";
|
||||
description = "Interface MTU on both ends. `null`: awg-quick's default (1280 with AWG 3 fields).";
|
||||
};
|
||||
|
||||
persistentKeepalive = mkOption {
|
||||
type = types.nullOr types.ints.unsigned;
|
||||
default = 25;
|
||||
description = "PersistentKeepalive in client configs, which keeps NAT mappings open.";
|
||||
description = "PersistentKeepalive in client configs, which keeps NAT open.";
|
||||
};
|
||||
|
||||
clientAllowedIPs = mkOption {
|
||||
@@ -126,7 +125,7 @@ let
|
||||
"xhttp"
|
||||
];
|
||||
default = "raw";
|
||||
description = ''Stream transport. "raw" is plain TCP, the usual choice for REALITY.'';
|
||||
description = ''Stream transport. "raw" is plain TCP, the usual pick for REALITY.'';
|
||||
example = "ws";
|
||||
};
|
||||
|
||||
@@ -137,7 +136,7 @@ let
|
||||
example = "/download";
|
||||
};
|
||||
|
||||
host = nullStr "Expected Host header (ws, httpupgrade, xhttp). Null accepts any." "cdn.example.com";
|
||||
host = nullStr "Expected Host header (ws, httpupgrade, xhttp). `null`: any." "cdn.example.com";
|
||||
|
||||
mode = mkOption {
|
||||
type = types.nullOr (
|
||||
@@ -149,7 +148,7 @@ let
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = ''xhttp mode. Null lets the client choose; behind an HTTP/1.1 proxy use "packet-up".'';
|
||||
description = ''xhttp mode. `null`: the client chooses. Behind an HTTP/1.1 proxy, use "packet-up".'';
|
||||
example = "packet-up";
|
||||
};
|
||||
|
||||
@@ -164,15 +163,13 @@ let
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Header names that mark a request as coming from the web server in front (ws, httpupgrade,
|
||||
xhttp, grpc). When one of them is present, XRay takes the client address from
|
||||
"X-Forwarded-For" instead of the socket. Needed for a listener on a loopback `address`:
|
||||
XRay otherwise sees 127.0.0.1, which it refuses to record, so `proxy-ctl inbounds online`
|
||||
shows every user as never seen and the stats keep no last-seen time.
|
||||
Headers that mark a request as coming from your web server (ws, httpupgrade, xhttp,
|
||||
grpc). If one is present, XRay takes the client address from "X-Forwarded-For". Needed
|
||||
behind a web server on loopback, or `proxy-ctl inbounds online` and the stats show no
|
||||
client addresses.
|
||||
|
||||
Set it only when the web server in front sets both the named header and "X-Forwarded-For"
|
||||
on every request it forwards, overwriting whatever the client sent: any client that can
|
||||
reach the listener directly could otherwise claim any address.
|
||||
Only set it if the web server overwrites both headers on every request. Otherwise any
|
||||
client that reaches the listener directly can fake its address.
|
||||
'';
|
||||
example = [ "X-Real-IP" ];
|
||||
};
|
||||
@@ -184,11 +181,11 @@ let
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Terminate TLS (always on for trojan). Exclusive with reality.";
|
||||
description = "Terminate TLS (always on for trojan). Cannot be used with `reality`.";
|
||||
};
|
||||
certificateFile = nullStr "Runtime path to the PEM certificate chain." "/var/lib/acme/example.com/fullchain.pem";
|
||||
keyFile = nullStr "Runtime path to the PEM private key." "/var/lib/acme/example.com/key.pem";
|
||||
serverName = nullStr "SNI in share links. Defaults to inbounds.serverAddress." "example.com";
|
||||
certificateFile = nullStr "File with the PEM certificate chain." "/var/lib/acme/example.com/fullchain.pem";
|
||||
keyFile = nullStr "File with the PEM private key." "/var/lib/acme/example.com/key.pem";
|
||||
serverName = nullStr "SNI in share links. Defaults to `inbounds.serverAddress`." "example.com";
|
||||
|
||||
alpn = mkOption {
|
||||
type = types.nullOr (
|
||||
@@ -202,8 +199,8 @@ let
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
ALPN offered and put in share links. [ "h3" ] alone makes an xhttp listener UDP-only, so
|
||||
a web server can keep the TCP port.
|
||||
ALPN offered and put in share links. `[ "h3" ]` alone makes an xhttp listener UDP-only,
|
||||
leaving the TCP port to a web server.
|
||||
'';
|
||||
example = [ "h3" ];
|
||||
};
|
||||
@@ -215,25 +212,25 @@ let
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable REALITY. Exclusive with tls.";
|
||||
description = "Enable REALITY. Cannot be used with `tls`.";
|
||||
};
|
||||
|
||||
dest = mkOption {
|
||||
type = types.str;
|
||||
default = "www.microsoft.com:443";
|
||||
description = "TLS 1.3 + HTTP/2 server that unauthenticated probes are forwarded to.";
|
||||
description = "Real TLS 1.3 + HTTP/2 site that non-client connections are forwarded to.";
|
||||
};
|
||||
|
||||
serverNames = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Accepted SNIs, served by dest. The first goes into share links.";
|
||||
description = "Accepted SNIs, served by `dest`. The first goes into share links.";
|
||||
example = [ "www.microsoft.com" ];
|
||||
};
|
||||
|
||||
privateKeyFile = nullStr "Runtime path to the x25519 private key (`xray x25519`)." "/run/secrets/proxy-inbound-reality-key";
|
||||
privateKey = nullStr "x25519 private key. Ends up in the Nix store; prefer privateKeyFile." "gG1Yz...";
|
||||
publicKey = nullStr "x25519 public key, required for share links." "jNXH...";
|
||||
privateKeyFile = nullStr "File with the x25519 private key (from `xray x25519`)." "/run/secrets/proxy-inbound-reality-key";
|
||||
privateKey = nullStr "x25519 private key. Ends up in the Nix store; prefer `privateKeyFile`." "gG1Yz...";
|
||||
publicKey = nullStr "x25519 public key, needed for share links." "jNXH...";
|
||||
|
||||
shortIds = mkOption {
|
||||
type = types.listOf types.str;
|
||||
@@ -246,7 +243,7 @@ let
|
||||
|
||||
fallbackType = types.submodule {
|
||||
options = {
|
||||
name = nullStr "SNI to match. Null matches any." "www.example.com";
|
||||
name = nullStr "SNI to match. `null`: any." "www.example.com";
|
||||
|
||||
alpn = mkOption {
|
||||
type = types.nullOr (
|
||||
@@ -256,29 +253,27 @@ let
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "Negotiated ALPN to match. Null matches any.";
|
||||
description = "ALPN to match. `null`: any.";
|
||||
example = "h2";
|
||||
};
|
||||
|
||||
path = nullStr ''
|
||||
Request path to match. Null matches any. XRay reads it from HTTP/1.1 only, so a `listener`
|
||||
must be on ws or httpupgrade, with this as its transport.path; xhttp and grpc clients speak h2
|
||||
and go by alpn = "h2" or a catch-all instead.
|
||||
Request path to match. `null`: any. Works for HTTP/1.1 only, so the target `listener` must
|
||||
use ws or httpupgrade with this as its `transport.path`. For xhttp and grpc (h2), match
|
||||
`alpn = "h2"` or use a catch-all.
|
||||
'' "/ws";
|
||||
|
||||
dest = mkOption {
|
||||
type = types.nullOr (types.either types.port types.str);
|
||||
default = null;
|
||||
description = "Where matching connections go: a port, host:port, or a unix socket path. Exclusive with listener.";
|
||||
description = "Where matching connections go: a port, host:port or unix socket path. Cannot be used with `listener`.";
|
||||
example = "127.0.0.1:8080";
|
||||
};
|
||||
|
||||
listener = nullStr ''
|
||||
Tag of another listener that matching connections go to, instead of dest. It must be a
|
||||
vless listener without tls or reality, on a loopback address: it gets the connection
|
||||
decrypted, with the client address in PROXY protocol, and its share links advertise this
|
||||
listener's port and TLS or REALITY. Behind REALITY it must be xhttp or grpc, the only
|
||||
transports REALITY clients run besides raw.
|
||||
Another listener to hand matching connections to, instead of `dest`. It must be a vless
|
||||
listener on loopback, without tls or reality. It gets decrypted traffic, and its share
|
||||
links use this listener's port and TLS or REALITY. Behind REALITY it must use xhttp or grpc.
|
||||
'' "ws-in";
|
||||
|
||||
xver = mkOption {
|
||||
@@ -288,7 +283,7 @@ let
|
||||
2
|
||||
];
|
||||
default = 0;
|
||||
description = "PROXY protocol version sent to dest; 0 sends none. A listener always gets 2.";
|
||||
description = "PROXY protocol version sent to `dest`, or 0 for none. A `listener` always gets 2.";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -312,10 +307,10 @@ let
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
Protocol. Set exactly one of type, xrayJson, or jsonFile. "amneziawg" is an AmneziaWG
|
||||
server on UDP port, with its own interface (see amneziaWg); its traffic is handed to XRay
|
||||
and leaves like any other listener's. "hysteria2" is QUIC on UDP port: it needs tls (a
|
||||
certificate) and takes passwords, and no transport, reality or flow.
|
||||
Protocol. Set exactly one of `type`, `xrayJson` or `jsonFile`.
|
||||
- "amneziawg": an AmneziaWG server on a UDP port (see `amneziaWg`). Its traffic exits
|
||||
like any other listener's.
|
||||
- "hysteria2": QUIC on a UDP port. Needs `tls` and passwords; no transport, reality or flow.
|
||||
'';
|
||||
example = "vless";
|
||||
};
|
||||
@@ -323,76 +318,75 @@ let
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 443;
|
||||
description = "Bound port. A raw-JSON listener's port must match it: the firewall and the port checks go by this one.";
|
||||
description = "Listening port. For raw JSON listeners it must match the JSON; the firewall uses this one.";
|
||||
};
|
||||
|
||||
sharePort = mkOption {
|
||||
type = types.nullOr types.port;
|
||||
default = null;
|
||||
description = "Port share links advertise, when something in front owns the public port. Null uses port.";
|
||||
description = "Port in share links, if something in front owns the public port. `null`: `port`.";
|
||||
example = 443;
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
type = types.strMatching "[^[:space:]]+";
|
||||
default = "::";
|
||||
description = "Bound address. A loopback address keeps the port closed in the firewall.";
|
||||
description = "Listening address. A loopback address keeps the port closed in the firewall.";
|
||||
example = "127.0.0.1";
|
||||
};
|
||||
|
||||
via = nullStr "Egress, as in inbounds.routing.via. Null inherits it." "nl-vps";
|
||||
via = nullStr "Where this listener's traffic exits, as in `inbounds.routing.via`. `null`: use that default." "nl-vps";
|
||||
|
||||
users = mkOption {
|
||||
type = types.listOf userType;
|
||||
default = [ ];
|
||||
description = "Accepted accounts.";
|
||||
description = "Accepted users.";
|
||||
example = [ { uuidFile = "/run/secrets/proxy-inbound-uuid"; } ];
|
||||
};
|
||||
|
||||
flow = mkOption {
|
||||
type = types.nullOr (types.enum [ "xtls-rprx-vision" ]);
|
||||
default = null;
|
||||
description = "VLESS flow; raw transport only.";
|
||||
description = "VLESS flow. Raw transport only.";
|
||||
example = "xtls-rprx-vision";
|
||||
};
|
||||
|
||||
method = mkOption {
|
||||
type = types.str;
|
||||
default = "2022-blake3-aes-128-gcm";
|
||||
description = "Shadowsocks cipher. 2022 ciphers take a base64 key of matching length as password; more than one user needs a 2022-blake3-aes cipher and serverPassword.";
|
||||
description = "Shadowsocks cipher. 2022 ciphers take a base64 key of matching length as the password. Multiple users need a 2022-blake3-aes cipher and `serverPassword`.";
|
||||
example = "aes-128-gcm";
|
||||
};
|
||||
|
||||
serverPassword = nullStr "Server key of a multi-user shadowsocks 2022 listener, shared by its users. Ends up in the Nix store; prefer serverPasswordFile." "c2VydmVyLWtleS0xNmJ5dGU=";
|
||||
serverPasswordFile = nullStr "Runtime path to the server key." "/run/secrets/proxy-inbound-ss-server-key";
|
||||
serverPassword = nullStr "Shared server key of a multi-user shadowsocks 2022 listener. Ends up in the Nix store; prefer `serverPasswordFile`." "c2VydmVyLWtleS0xNmJ5dGU=";
|
||||
serverPasswordFile = nullStr "File with the server key." "/run/secrets/proxy-inbound-ss-server-key";
|
||||
|
||||
transport = mkOption {
|
||||
type = transportType;
|
||||
default = { };
|
||||
description = "Stream transport.";
|
||||
description = "Transport settings.";
|
||||
};
|
||||
|
||||
tls = mkOption {
|
||||
type = tlsType;
|
||||
default = { };
|
||||
description = "TLS termination.";
|
||||
description = "TLS settings.";
|
||||
};
|
||||
|
||||
reality = mkOption {
|
||||
type = realityType;
|
||||
default = { };
|
||||
description = "REALITY.";
|
||||
description = "REALITY settings.";
|
||||
};
|
||||
|
||||
fallbacks = mkOption {
|
||||
type = types.listOf fallbackType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Where XRay sends connections that are not this listener's protocol, so several share
|
||||
one port (vless or trojan on the raw transport). Matched in order on SNI, ALPN and path;
|
||||
the first entry without any is the catch-all, such as a decoy web server. Browsers
|
||||
negotiate h2 unless tls.alpn says otherwise, so a dest that speaks only HTTP/1.1 needs
|
||||
tls.alpn = [ "http/1.1" ], or an alpn = "h2" entry to one that speaks h2c.
|
||||
Where to send connections that are not this listener's protocol, so several services
|
||||
share one port (vless or trojan on raw transport). Entries match in order by SNI, ALPN
|
||||
and path; one with none of these is the catch-all, such as a decoy site. Browsers use h2
|
||||
by default, so an HTTP/1.1-only `dest` needs `tls.alpn = [ "http/1.1" ]`.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
[
|
||||
@@ -405,24 +399,24 @@ let
|
||||
xrayJson = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
description = "Raw XRay inbound, built into the store; tag is overridden and port, if left out, filled in.";
|
||||
description = "Raw XRay inbound JSON (ends up in the Nix store). Its tag is replaced; a missing port is filled in.";
|
||||
example = {
|
||||
protocol = "dokodemo-door";
|
||||
settings.port = 8080;
|
||||
};
|
||||
};
|
||||
|
||||
jsonFile = nullStr "Runtime path to a raw XRay inbound (no share link); tag is overridden and port, if left out, filled in." "/run/secrets/proxy-inbound-vless.json";
|
||||
jsonFile = nullStr "File with a raw XRay inbound JSON (no share link). Its tag is replaced; a missing port is filled in." "/run/secrets/proxy-inbound-vless.json";
|
||||
|
||||
hysteria.masquerade = nullStr ''
|
||||
Site that a hysteria2 listener serves, reverse-proxied, to anything that is not a client
|
||||
(a browser, a prober). Null answers them with 404.
|
||||
Site shown to anything that is not a hysteria2 client, such as browsers and probes.
|
||||
`null`: answer 404.
|
||||
'' "https://www.example.com";
|
||||
|
||||
amneziaWg = mkOption {
|
||||
type = mkAmneziaWgType name;
|
||||
default = { };
|
||||
description = ''The AmneziaWG server of a type = "amneziawg" listener.'';
|
||||
description = ''AmneziaWG server settings, for `type = "amneziawg"`.'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ let
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Tag of the outbound ${what} connects through: a proxy chain. Any outbound can be the hop,
|
||||
subscription entries, `warp`, `ssh-proxy` and AmneziaWG ones included. On hybrid, an
|
||||
outbound that runs on XRay can only chain through another XRay one. ShadowTLS works this
|
||||
way too: a `shadowtls` outbound in singBoxJson, and the shadowsocks one with detour naming it.
|
||||
Tag of an outbound that ${what} connects through (a proxy chain). Any outbound works,
|
||||
including subscription entries, `warp`, `ssh-proxy` and AmneziaWG. On hybrid, an XRay
|
||||
outbound can only chain through another XRay one. For ShadowTLS, put a `shadowtls`
|
||||
outbound in `singBoxJson` and point the shadowsocks outbound's `detour` at it.
|
||||
'';
|
||||
example = "ru-vps";
|
||||
};
|
||||
@@ -29,11 +29,11 @@ let
|
||||
options = {
|
||||
tag = mkOption {
|
||||
type = types.strMatching "^[A-Za-z0-9][A-Za-z0-9._-]*$";
|
||||
description = "Unique name; prefixes the tags of its outbounds and names its cache file.";
|
||||
description = "Unique name, used as a prefix for the tags of its outbounds.";
|
||||
example = "community-list";
|
||||
};
|
||||
url = nullStr "Subscription URL. Ends up in the Nix store; prefer urlFile." "https://example.com/sub/token123";
|
||||
urlFile = nullStr "Runtime path to the subscription URL." "/run/secrets/proxy-subscription-url";
|
||||
url = nullStr "Subscription URL. Ends up in the Nix store; prefer `urlFile`." "https://example.com/sub/token123";
|
||||
urlFile = nullStr "File with the subscription URL." "/run/secrets/proxy-subscription-url";
|
||||
detour = detourOption "every entry of this subscription";
|
||||
};
|
||||
};
|
||||
@@ -42,24 +42,28 @@ let
|
||||
options = {
|
||||
tag = mkOption {
|
||||
type = types.str;
|
||||
description = "Outbound tag, for routing rules and selection.";
|
||||
description = "Unique name, used in routing rules, `detour` and `proxy-ctl`. Not \"proxy\", \"direct\" or \"block\".";
|
||||
example = "vps-de";
|
||||
};
|
||||
|
||||
url = nullStr "Proxy URL. Ends up in the Nix store; prefer urlFile." "hy2://password@example.com:443?sni=example.com";
|
||||
urlFile = nullStr "Runtime path to the proxy URL." "/run/secrets/my-proxy-url";
|
||||
detour = detourOption "this one";
|
||||
url = nullStr "Proxy link. Ends up in the Nix store; prefer `urlFile`." "hy2://password@example.com:443?sni=example.com";
|
||||
urlFile = nullStr "File with the proxy link." "/run/secrets/my-proxy-url";
|
||||
detour = detourOption "this outbound";
|
||||
|
||||
singBoxJson = nullAttrs "Raw sing-box outbound (sing-box backend); tag is overridden." {
|
||||
type = "vless";
|
||||
server = "example.com";
|
||||
server_port = 443;
|
||||
};
|
||||
singBoxJson =
|
||||
nullAttrs "Raw sing-box outbound JSON, instead of `url` (sing-box backend). Its tag is replaced."
|
||||
{
|
||||
type = "vless";
|
||||
server = "example.com";
|
||||
server_port = 443;
|
||||
};
|
||||
|
||||
xrayJson = nullAttrs "Raw XRay outbound (XRay backend); tag is overridden." {
|
||||
protocol = "vless";
|
||||
settings.address = "example.com";
|
||||
};
|
||||
xrayJson =
|
||||
nullAttrs "Raw XRay outbound JSON, instead of `url` (XRay backend). Its tag is replaced."
|
||||
{
|
||||
protocol = "vless";
|
||||
settings.address = "example.com";
|
||||
};
|
||||
|
||||
backend = mkOption {
|
||||
type = types.enum [
|
||||
@@ -69,14 +73,13 @@ let
|
||||
];
|
||||
default = "auto";
|
||||
description = ''
|
||||
Backend for this outbound when both run. "auto" prefers sing-box and falls back to XRay
|
||||
for XRay-only transports (XHTTP, ECH).
|
||||
Which engine runs this outbound on the hybrid backend. "auto" uses sing-box, or XRay for
|
||||
XRay-only transports (XHTTP, ECH).
|
||||
'';
|
||||
example = "xray";
|
||||
};
|
||||
|
||||
# Destinations sent to this outbound, whatever the selection.
|
||||
routing = routingFields;
|
||||
routing = routingFields "always sent to this outbound, whatever the selection";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
@@ -27,14 +27,14 @@ let
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.strMatching "^[a-z0-9][a-z0-9-]*$";
|
||||
description = "Hostlist name (hostlists/list-<name>.txt).";
|
||||
description = "List name.";
|
||||
example = "cloudflare";
|
||||
};
|
||||
|
||||
domains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Domains in this hostlist.";
|
||||
description = "Domains in this list.";
|
||||
example = [ "example.com" ];
|
||||
};
|
||||
|
||||
@@ -42,8 +42,8 @@ let
|
||||
type = types.listOf zapretDefaultDomainType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Upstream lists to include ("discord" = "general", "youtube" = "google"). Without preset,
|
||||
use one per rule so the strategy family can be inferred.
|
||||
Upstream lists to include ("discord" is "general", "youtube" is "google"). Without
|
||||
`preset`, use only one, so the strategy can be inferred from it.
|
||||
'';
|
||||
example = [ "google" ];
|
||||
};
|
||||
@@ -51,42 +51,42 @@ let
|
||||
ips = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "IPs/CIDRs in this rule's ipset.";
|
||||
description = "IPs or CIDRs in this list.";
|
||||
example = [ "203.0.113.0/24" ];
|
||||
};
|
||||
|
||||
defaultIps = mkOption {
|
||||
type = types.listOf zapretDefaultIpType;
|
||||
default = [ ];
|
||||
description = ''Upstream ipsets to include ("all" is ipset-all.txt).'';
|
||||
description = "Upstream IP lists to include.";
|
||||
example = [ "all" ];
|
||||
};
|
||||
|
||||
preset = mkOption {
|
||||
type = types.nullOr zapretPresetType;
|
||||
default = null;
|
||||
description = "Strategy family to clone, from configName or the active config.";
|
||||
description = "Strategy to copy, from `configName` or the active config.";
|
||||
example = "google";
|
||||
};
|
||||
|
||||
configName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Config to clone strategies from. Exclusive with nfqwsArgs.";
|
||||
description = "Config to copy the strategy from. Cannot be used with `nfqwsArgs`.";
|
||||
example = "general(ALT9)";
|
||||
};
|
||||
|
||||
nfqwsArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Raw NFQWS arguments; --hostlist and --new are added. Exclusive with configName.";
|
||||
description = "Raw nfqws arguments; `--hostlist` and `--new` are added. Cannot be used with `configName`.";
|
||||
example = [ "--filter-tcp=443 --dpi-desync=fake,multisplit" ];
|
||||
};
|
||||
|
||||
enableDirectSync = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Include these domains in zapret.directSync.";
|
||||
description = "Include these domains in `zapret.directSync`.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,12 +5,12 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.userControl = {
|
||||
enable = lib.mkEnableOption "passwordless `proxy-ctl` control for the members of userControl.group";
|
||||
enable = lib.mkEnableOption "`proxy-ctl` without root for members of `userControl.group`";
|
||||
|
||||
group = mkOption {
|
||||
type = types.strMatching "^[a-z_][a-z0-9_-]*$";
|
||||
default = "proxy-suite";
|
||||
description = "Group whose members may run privileged `proxy-ctl` commands without a password.";
|
||||
description = "Group whose members can run privileged `proxy-ctl` commands.";
|
||||
};
|
||||
|
||||
scopes = mkOption {
|
||||
@@ -29,16 +29,16 @@ in
|
||||
);
|
||||
default = [ ];
|
||||
description = ''
|
||||
What userControl.group may do; empty allows every scope.
|
||||
- "services": turn the proxy-suite units on and off (proxy, tun, tproxy, zapret, ssh, warp, tor, tg, awg, inbounds), `restart`, and `tor status|newnym` on Tor's control socket.
|
||||
- "perApp": the per-app backend units used by `proxy-ctl apps run`.
|
||||
What the group may do. Empty allows everything.
|
||||
- "services": start, stop and restart services, and `tor newnym`.
|
||||
- "perApp": `proxy-ctl apps run`.
|
||||
- "routing": `proxy pin`, `proxy unpin` and `proxy mode`.
|
||||
- "outbounds": add and remove runtime outbounds and subscriptions, disable and enable outbounds, and update subscriptions.
|
||||
- "secrets": read share links, subscription URLs and the running configs.
|
||||
- "autoProxy": read what autoProxy learned, and `proxy auto learn|forget|relearn|clear`.
|
||||
- "zapret": edit zapret2's learned hosts, and `zapret cutoff probe`.
|
||||
- "outbounds": add, remove, enable and disable outbounds and subscriptions.
|
||||
- "secrets": read share links, subscription URLs and running configs.
|
||||
- "autoProxy": see and change what autoProxy learned.
|
||||
- "zapret": change zapret2's learned sites, and `zapret cutoff probe`.
|
||||
- "stats": `inbounds stats`.
|
||||
- "whitelistBypass": the whitelist-bypass creators and joiners: `wl on|off|toggle|restart`, their calls (`wl link`), and their logins and links (`wl auth|join|new`).
|
||||
- "whitelistBypass": everything under `proxy-ctl wl`.
|
||||
'';
|
||||
example = [
|
||||
"services"
|
||||
|
||||
@@ -6,19 +6,19 @@ let
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.warp = {
|
||||
enable = mkEnableOption "Cloudflare WARP";
|
||||
enable = mkEnableOption "Cloudflare WARP" // {
|
||||
description = "Run Cloudflare WARP. Also set `asOutbound` or `asAmneziaWg`.";
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to a WireGuard profile for WARP, as written by `wgcf register && wgcf generate`.
|
||||
AmneziaWG lines (Jc, S1-S4, H1-H4, I1-I5, AWG 3 timing) are honoured by the AmneziaWG profile
|
||||
(asAmneziaWg, asOutbound = "interface") only.
|
||||
File with a WARP WireGuard profile, from `wgcf register && wgcf generate`. AmneziaWG
|
||||
fields in it only take effect in the AmneziaWG modes.
|
||||
|
||||
When null, proxy-suite-warp registers a device with wgcf (accepting Cloudflare's terms)
|
||||
into /var/lib/proxy-suite/warp, through the local proxy when proxy.enable is set, and
|
||||
retries until it succeeds. Until then warp connections fail.
|
||||
`null`: register a new device with wgcf on first start (accepting Cloudflare's terms),
|
||||
through the local proxy if enabled. WARP does not work until that succeeds.
|
||||
'';
|
||||
example = "/run/secrets/wgcf-profile.conf";
|
||||
};
|
||||
@@ -27,20 +27,18 @@ in
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
HTTPS URL of a WARP profile generator, fetched directly when wgcf registration fails
|
||||
(e.g. the Cloudflare API is blocked and there is no local proxy). It must return a
|
||||
WireGuard profile, or JSON with the base64 profile in `.content`.
|
||||
URL of a WARP profile generator, used if wgcf registration fails (for example, when the
|
||||
Cloudflare API is blocked). It must return a WireGuard profile, or JSON with the base64
|
||||
profile in `.content`.
|
||||
|
||||
The generator registers the device, so its operator sees the private key.
|
||||
Its operator sees your private key.
|
||||
'';
|
||||
example = "https://valokda-amnezia.vercel.app/api/warp?mode=awg2";
|
||||
};
|
||||
|
||||
endpoint = endpoint ''
|
||||
host:port that replaces the profile's Endpoint (IPv6 in brackets), for when the default
|
||||
engage.cloudflareclient.com:2408 is blocked: another Cloudflare address, another port WARP
|
||||
answers on (500, 1701, 4500, ...), or a relay. Applied in every mode when the tunnel or
|
||||
AmneziaWG profile starts; the profile file itself is left as is.
|
||||
host:port (IPv6 in brackets) to use instead of the profile's endpoint, if the default one
|
||||
is blocked: another Cloudflare address, another WARP port (500, 1701, 4500, …), or a relay.
|
||||
'';
|
||||
|
||||
asOutbound = mkOption {
|
||||
@@ -54,14 +52,10 @@ in
|
||||
default = null;
|
||||
description = ''
|
||||
Add WARP as an outbound tagged "warp".
|
||||
- "singBox": a SOCKS hop to proxy-suite-warp-tunnel, which runs WARP as a sing-box WireGuard
|
||||
endpoint on 127.0.0.1:18538, as the proxy-suite-daemon user. The tunnel starts again on a
|
||||
new source port when WARP does not answer within 15 seconds of a start, or misses three
|
||||
probes later on, unless the uplink itself is down.
|
||||
- "userspace": an AmneziaWG profile named "warp" with asOutbound = "userspace", which honours
|
||||
the AmneziaWG lines of the profile without an interface or root. Requires amneziaWg.enable.
|
||||
- "interface": an AmneziaWG profile named "warp" with asOutbound = "interface", which honours
|
||||
the AmneziaWG lines of the profile. Requires amneziaWg.enable.
|
||||
- "singBox": plain WireGuard in sing-box, ignoring AmneziaWG fields. Restarts itself when
|
||||
WARP stops answering.
|
||||
- "userspace": an AmneziaWG profile, without root. Needs `amneziaWg.enable`.
|
||||
- "interface": an AmneziaWG profile with its own interface. Needs `amneziaWg.enable`.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -69,8 +63,8 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Add an AmneziaWG profile named "warp" (`proxy-ctl awg on warp`). Requires amneziaWg.enable,
|
||||
and excludes asOutbound: both would use the same WARP key.
|
||||
Add a global AmneziaWG profile named "warp" (`proxy-ctl awg on warp`). Needs
|
||||
`amneziaWg.enable`. Cannot be used with `asOutbound`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ let
|
||||
"dion"
|
||||
"bitrix"
|
||||
];
|
||||
description = "Call platform the creator on the other end uses. VK has no Linux joiner.";
|
||||
description = "Call platform the creator uses. VK has no joiner here.";
|
||||
example = "wbstream";
|
||||
};
|
||||
|
||||
@@ -20,10 +20,8 @@ let
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the call link the creator printed (or wrote to its state directory):
|
||||
a WB Stream room id, a Telemost link, a DION event slug or a Bitrix conference link.
|
||||
`proxy-ctl wl join <name> <link>` sets one at runtime, which wins over this. Null
|
||||
leaves the joiner off until then.
|
||||
File with the call link from the creator's log. `proxy-ctl wl join <name> <link>` sets
|
||||
one at runtime and takes priority. `null`: the joiner waits for that.
|
||||
'';
|
||||
example = "/run/secrets/whitelist-bypass-link";
|
||||
};
|
||||
@@ -41,8 +39,7 @@ let
|
||||
"vk"
|
||||
];
|
||||
description = ''
|
||||
Call platform. Every one needs an account: "vk" only serves the upstream Android app,
|
||||
the rest a joiner of this module too.
|
||||
Call platform. Each needs an account. "vk" only serves the upstream Android joiner app.
|
||||
'';
|
||||
example = "wbstream";
|
||||
};
|
||||
@@ -51,11 +48,10 @@ let
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the platform's cookies, as the upstream desktop Creator exports them.
|
||||
Copied into the state directory on first start only: DION and Bitrix rotate their
|
||||
refresh token into that copy, and a stale one would kill the session.
|
||||
`proxy-ctl wl auth <name>` replaces that copy at runtime, with a new export or, for
|
||||
DION and Bitrix, an email and password. Null leaves the creator off until then.
|
||||
File with the platform's cookies, as exported by the upstream desktop Creator. Read on
|
||||
first start only, since the login refreshes itself afterwards. `proxy-ctl wl auth
|
||||
<name>` replaces it at runtime (or asks for email and password on DION and Bitrix).
|
||||
`null`: the creator waits for that.
|
||||
'';
|
||||
example = "/run/secrets/whitelist-bypass-cookies-wbstream.json";
|
||||
};
|
||||
@@ -64,10 +60,9 @@ let
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the call to rejoin. Null rejoins the last call written to
|
||||
`<stateDir>/whitelist-bypass/<name>.link`, and creates one on first start: the link
|
||||
stays the same across restarts, so the joiner needs it only once. `proxy-ctl wl new
|
||||
<name>` drops it for a new call, when the platform has closed the old one.
|
||||
File with a call link to rejoin. `null`: create a call once and keep reusing it, so
|
||||
the joiner needs the link only once. `proxy-ctl wl new <name>` starts a new call if the
|
||||
platform closed the old one.
|
||||
'';
|
||||
example = "/run/secrets/whitelist-bypass-link";
|
||||
};
|
||||
@@ -79,10 +74,9 @@ let
|
||||
];
|
||||
default = "direct";
|
||||
description = ''
|
||||
Where the joiner's traffic leaves.
|
||||
- "direct": from this host, past TUN and TProxy (it runs as proxy-suite-daemon).
|
||||
- "proxy": through the local proxy listener (proxy.listener, with its auth), and so
|
||||
its outbounds and routing.
|
||||
Where the traffic from this creator's joiner exits.
|
||||
- "direct": straight from this host, bypassing TUN and TProxy.
|
||||
- "proxy": through the local proxy and its routing.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -93,31 +87,34 @@ let
|
||||
"unlimited"
|
||||
];
|
||||
default = "moderate";
|
||||
description = "Buffer sizes and Go memory limit: 64, 128 or 256 MB.";
|
||||
description = "Memory budget: 64, 128 or 256 MB.";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.whitelistBypass = {
|
||||
enable = mkEnableOption ''
|
||||
tunnels through the media servers of video calls, which mobile internet whitelists let
|
||||
through ([whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)). A creator on a
|
||||
free host serves exactly one joiner on a censored one'';
|
||||
enable = mkEnableOption "whitelist-bypass" // {
|
||||
description = ''
|
||||
Tunnel through video-call servers, which mobile internet whitelists let through
|
||||
([whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)). A creator on a free
|
||||
host serves one joiner on a censored one.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = proxySuiteUpstream.whitelist-bypass;
|
||||
defaultText = lib.literalMD "proxy-suite's `whitelist-bypass` (`pkgs/whitelist-bypass.nix`)";
|
||||
description = "whitelist-bypass package with the headless creators and joiners.";
|
||||
description = "whitelist-bypass package.";
|
||||
};
|
||||
|
||||
joiners = mkOption {
|
||||
type = types.attrsOf joinerType;
|
||||
default = { };
|
||||
description = ''
|
||||
Joiners, each an outbound tagged with its name: a loopback SOCKS5 listener that tunnels
|
||||
through the call. Needs proxy.enable.
|
||||
Joiners, each an outbound tagged with its name that tunnels through the call. Needs
|
||||
`proxy.enable`.
|
||||
'';
|
||||
example = {
|
||||
wl = {
|
||||
@@ -130,7 +127,7 @@ in
|
||||
creators = mkOption {
|
||||
type = types.attrsOf creatorType;
|
||||
default = { };
|
||||
description = "Creators, one per joiner device. The link each uses is in its log.";
|
||||
description = "Creators, one per joiner device. Each logs the call link its joiner needs (also `proxy-ctl wl link`).";
|
||||
example = {
|
||||
phone = {
|
||||
platform = "wbstream";
|
||||
|
||||
@@ -16,30 +16,31 @@ in
|
||||
];
|
||||
default = "zapret-discord-youtube";
|
||||
description = ''
|
||||
"zapret-discord-youtube": nfqws with curated presets and static hostlists (zapret.zapret-discord-youtube).
|
||||
"zapret2": nfqws2, which learns blocked hosts at runtime (zapret.zapret2).
|
||||
Which zapret to run:
|
||||
- "zapret-discord-youtube": ready-made presets and fixed site lists.
|
||||
- "zapret2": learns blocked sites at runtime.
|
||||
'';
|
||||
example = "zapret2";
|
||||
};
|
||||
|
||||
# What zapret feeds back into the client routing table.
|
||||
directSync = {
|
||||
enable = bool true "Add zapret's domain hostlists to proxy.routing.direct.";
|
||||
upstreamIps = bool false "Add zapret's upstream ipsets to proxy.routing.direct.";
|
||||
userIps = bool true "Add zapret-discord-youtube.ips, minus zapret-discord-youtube.excludeIps, to proxy.routing.direct.";
|
||||
enable = bool true "Send zapret's domains direct in the proxy routing, so zapret handles them.";
|
||||
upstreamIps = bool false "Also send zapret's upstream IP lists direct.";
|
||||
userIps = bool true "Also send `zapret-discord-youtube.ips` (minus `excludeIps`) direct.";
|
||||
};
|
||||
|
||||
# Shared by both engines: a netfilter-level bypass, not an engine-specific concept.
|
||||
cidrExemption = {
|
||||
enable = mkEnableOption "exempting subnets from zapret, e.g. NATed VMs whose traffic it would break";
|
||||
cidrs = list "Exempted subnets." [ "192.168.123.0/24" ];
|
||||
enable = mkEnableOption "skipping zapret for some subnets, such as NATed VMs it would break";
|
||||
cidrs = list "Subnets zapret skips." [ "192.168.123.0/24" ];
|
||||
};
|
||||
|
||||
zapret-discord-youtube = {
|
||||
configName = mkOption {
|
||||
type = types.str;
|
||||
default = "general(ALT)";
|
||||
description = "Upstream strategy preset. Names that differ only in whitespace match.";
|
||||
description = "Strategy preset name (spaces are ignored).";
|
||||
example = "general (ALT9)";
|
||||
};
|
||||
|
||||
@@ -51,14 +52,14 @@ in
|
||||
"null"
|
||||
];
|
||||
default = "null";
|
||||
description = ''Game traffic filter, or "null" for off.'';
|
||||
description = ''Which game traffic to handle, or "null" for none.'';
|
||||
example = "all";
|
||||
};
|
||||
|
||||
domains = list "Extra domains to bypass." [ "youtube.com" ];
|
||||
excludeDomains = list "Domains never bypassed." [ "music.youtube.com" ];
|
||||
ips = list "Extra IPs/CIDRs to bypass." [ "203.0.113.0/24" ];
|
||||
excludeIps = list "IPs/CIDRs never bypassed." [ "203.0.113.10/32" ];
|
||||
domains = list "Extra domains to unblock." [ "youtube.com" ];
|
||||
excludeDomains = list "Domains zapret never touches." [ "music.youtube.com" ];
|
||||
ips = list "Extra IPs or CIDRs to unblock." [ "203.0.113.0/24" ];
|
||||
excludeIps = list "IPs or CIDRs zapret never touches." [ "203.0.113.10/32" ];
|
||||
|
||||
includeExtraUpstreamLists = bool false "Also use the upstream instagram, soundcloud and twitter lists.";
|
||||
|
||||
@@ -66,8 +67,8 @@ in
|
||||
type = types.listOf t.zapretHostlistRuleType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Extra named hostlists, each with its own strategy: cloned from a preset or configName,
|
||||
or given as nfqwsArgs.
|
||||
Extra site lists, each with its own strategy: copied from a `preset` or `configName`,
|
||||
or given as raw `nfqwsArgs`.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
int = (import ./lib.nix { inherit lib; }).positiveInt;
|
||||
fromSource = what: "null uses the ${what} of strategySource.";
|
||||
fromSource = what: "`null`: use the ${what} from `strategySource`.";
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.zapret.zapret2 = {
|
||||
@@ -14,14 +14,11 @@ in
|
||||
];
|
||||
default = "nfqws2-keenetic";
|
||||
description = ''
|
||||
Where profiles, blobs and ports come from; both are pinned flake inputs.
|
||||
"nfqws2-keenetic": its nfqws2.conf strategies with its user and exclude lists.
|
||||
"z2k": z2k's own config generator, run at build time: per-category rotation pools
|
||||
(general, YouTube, googlevideo, QUIC, Discord), its failure detectors and fake-TTL
|
||||
hook, its blobs, whitelist and hostlists, including the ~125k-domain RKN list
|
||||
(about 15 MB more RSS per nfqws2 process).
|
||||
Either way each host's working strategy is remembered across restarts in
|
||||
/var/lib/proxy-suite/zapret2/circular/state.tsv.
|
||||
Where the strategies, blobs and ports come from.
|
||||
- "nfqws2-keenetic": its strategies and site lists.
|
||||
- "z2k": z2k's strategies, which rotate per category (YouTube, Discord, QUIC, …), with
|
||||
its site lists, including the full RKN list (more memory).
|
||||
Either way, each site's working strategy is remembered across restarts.
|
||||
'';
|
||||
example = "z2k";
|
||||
};
|
||||
@@ -30,9 +27,9 @@ in
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
nfqws2 profiles replacing those of strategySource, joined with --new; first match wins.
|
||||
<HOSTLIST> expands to the hostlist arguments, <HOSTLIST_NOAUTO> to the same without
|
||||
learning. --qnum, --fwmark and --lua-init are added automatically. ${fromSource "profiles"}
|
||||
Your own nfqws2 profiles, instead of those from `strategySource`. The first match wins.
|
||||
`<HOSTLIST>` expands to the site list arguments, `<HOSTLIST_NOAUTO>` to the same without
|
||||
learning. `--qnum`, `--fwmark` and `--lua-init` are added for you. ${fromSource "profiles"}
|
||||
'';
|
||||
example = [
|
||||
"--filter-tcp=443 --filter-l7=tls <HOSTLIST> --payload=tls_client_hello --lua-desync=multisplit:pos=1,midsld"
|
||||
@@ -42,7 +39,7 @@ in
|
||||
blobs = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = "Fake payloads by name (blob=<name>) on top of those of strategySource: a file in zapret2's files/fake, or an absolute path.";
|
||||
description = "Extra fake payloads by name (blob=<name>): a file in zapret2's files/fake, or an absolute path.";
|
||||
example = {
|
||||
tls_clienthello = "/etc/proxy-suite/my_clienthello.bin";
|
||||
};
|
||||
@@ -66,14 +63,14 @@ in
|
||||
tcp = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "TCP ports sent to NFQUEUE. Must cover every port a profile filters on. ${fromSource "ports"}";
|
||||
description = "TCP ports zapret2 handles. Must include every port a profile uses. ${fromSource "ports"}";
|
||||
example = "80,443";
|
||||
};
|
||||
|
||||
udp = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "UDP ports sent to NFQUEUE. Must cover every port a profile filters on. ${fromSource "ports"}";
|
||||
description = "UDP ports zapret2 handles. Must include every port a profile uses. ${fromSource "ports"}";
|
||||
example = "443";
|
||||
};
|
||||
};
|
||||
@@ -81,40 +78,37 @@ in
|
||||
ipv6 = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Intercept IPv6 as well as IPv4.";
|
||||
description = "Handle IPv6 too.";
|
||||
};
|
||||
|
||||
autoHostlist = {
|
||||
enable = mkEnableOption "learning blocked hosts at runtime" // {
|
||||
default = true;
|
||||
description = ''
|
||||
Learn blocked hosts: after failThreshold failures (retransmissions, early RST, DPI
|
||||
redirect, one-sided UDP) a host joins /var/lib/proxy-suite/zapret2/zapret-hosts-auto.txt.
|
||||
Off, only zapret2.domains and `proxy-ctl zapret auto add` are acted on.
|
||||
The thresholds below also fill whichever of them a profile's strategy rotation
|
||||
(circular) leaves unset; its own fails and time are kept.
|
||||
Learn blocked sites: after `failThreshold` failed connections, a site is treated as
|
||||
blocked. When off, only `zapret2.domains` and `proxy-ctl zapret auto add` are used.
|
||||
'';
|
||||
};
|
||||
|
||||
failThreshold = int 3 "Failures before a host is learned.";
|
||||
failTime = int 300 "Seconds allowed between two failures before the count resets.";
|
||||
retransThreshold = int 3 "Retransmissions of the first request that count as one failure.";
|
||||
failThreshold = int 3 "Failures before a site is learned.";
|
||||
failTime = int 300 "Seconds without a failure before the count resets.";
|
||||
retransThreshold = int 3 "Retransmissions of the first request that count as a failure.";
|
||||
|
||||
retransReset = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "RST a stalled client once retransThreshold is hit, so failures are counted fast.";
|
||||
description = "Reset a stalled connection at `retransThreshold`, so failures are counted faster.";
|
||||
};
|
||||
|
||||
retransMaxseq = int 32768 "Outgoing sequence number past which failure detection stops.";
|
||||
incomingMaxseq = int 4096 "Incoming sequence number past which an RST or redirect is not a failure.";
|
||||
udpOut = int 4 "Outgoing UDP packets before a one-sided exchange counts as a failure.";
|
||||
udpIn = int 1 "Incoming UDP packets at or below which an exchange is one-sided.";
|
||||
retransMaxseq = int 32768 "Stop watching a connection for failures after this many bytes sent.";
|
||||
incomingMaxseq = int 4096 "After this many bytes received, a reset or redirect is not a failure.";
|
||||
udpOut = int 4 "UDP packets sent, with at most `udpIn` replies, that count as a failure.";
|
||||
udpIn = int 1 "Most UDP replies that still count as no answer (see `udpOut`).";
|
||||
|
||||
debugLog = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Log why hosts are or are not learned to zapret-hosts-auto-debug.log.";
|
||||
description = "Log why sites are or are not learned.";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -122,13 +116,10 @@ in
|
||||
enable = mkEnableOption "the 16 KB cutoff probe" // {
|
||||
default = true;
|
||||
description = ''
|
||||
Some lines let TLS to certain hosting networks handshake and then cut it at 12-34 KB,
|
||||
which no strategy fixes. z2k's probe checks this line against ~110 known targets when
|
||||
its network changes and once a day, and for each cut-off network searches a whitelisted
|
||||
name that nfqws2 then puts into a fake ClientHello (strategySource "z2k" only; ahead of
|
||||
the nfqws2-keenetic strategies it breaks them): thousands of short TLS connections to
|
||||
foreign hosting IPs per full run, sent directly and never touched by zapret2. State and
|
||||
maps live in /var/lib/proxy-suite/zapret2/cutoff; `proxy-ctl zapret cutoff` shows them.
|
||||
Work around ISPs that cut TLS to some hosting networks after about 16 KB, which no
|
||||
strategy fixes. A daily probe finds the affected networks and a whitelisted name that
|
||||
gets through for each. Only with `strategySource = "z2k"`. Each run makes thousands of
|
||||
short direct connections. `proxy-ctl zapret cutoff` shows the results.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -136,10 +127,9 @@ in
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Route the cut-off networks no name fixes through the proxy outbound. Needs the sing-box
|
||||
backend with an outbound and a route mode other than all-bypass, and only applies to
|
||||
traffic the backend sees by address (TUN, TProxy, per-app routing, clients that dial IPs);
|
||||
explicit direct rules still win.
|
||||
Send cut-off networks that no name fixes through the proxy. Needs the sing-box backend,
|
||||
an outbound, and a route mode other than all-bypass. Only works for traffic the proxy
|
||||
sees by IP (TUN, TProxy, per-app routing). Explicit direct rules still win.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user