Files
proxy-suite-flake/docs/options/proxy.md
T

35 KiB
Raw Blame History

services.proxy-suite.proxy

The local proxy: outbounds, subscriptions, selection, routing, DNS, TUN and TProxy.

Part of the proxy-suite options reference.

Options

services.proxy-suite.proxy.enable

Whether to enable the local proxy.

Type: boolean
Default: false

services.proxy-suite.proxy.autoProxy.enable

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.

Type: boolean
Default: false

services.proxy-suite.proxy.autoProxy.exclude

Domains (with subdomains) never probed or routed by autoProxy.

Type: list of string
Default: [ ]
Example: [ "internal.example" ]

services.proxy-suite.proxy.autoProxy.interval

Time between probe runs. proxy-ctl proxy auto learn probes right away.

Type: string
Default: "10m"
Example: "30m"

services.proxy-suite.proxy.autoProxy.maxExits

Maximum exits tried per destination, direct included. One exit per network is tried first, then the rest.

Type: positive integer, meaning >0
Default: 12

services.proxy-suite.proxy.autoProxy.probeBasePort

First of maxExits loopback ports used for probing, one per exit. They have no authentication, even with proxy.listener.auth set.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 18540

services.proxy-suite.proxy.autoProxy.probesPerRun

Maximum destinations probed per run. The rest wait for the next run, most-used first.

Type: positive integer, meaning >0
Default: 200

services.proxy-suite.proxy.autoProxy.slowBelowKiBps

Also route destinations that work directly but stay slower than this, in KiB/s. 0 disables. Needs selection other than “first”.

Type: unsigned integer, meaning >=0
Default: 150
Example: 0

services.proxy-suite.proxy.autoProxy.ttlDays

Days before a result is probed again. Everything is probed again when this host’s public address changes.

Type: positive integer, meaning >0
Default: 30

services.proxy-suite.proxy.autostart

Transparent mode to start at boot, or null for none. That mode must also be enabled (proxy.tun.enable or proxy.tproxy.enable).

Type: null or one of “tun”, “tproxy”
Default: null
Example: "tun"

services.proxy-suite.proxy.backend

Proxy engine. “hybrid” runs sing-box and hands XRay-only outbounds (XHTTP, ECH) to XRay.

Type: one of “sing-box”, “xray”, “hybrid”
Default: "sing-box"
Example: "hybrid"

services.proxy-suite.proxy.dns.clientSubnet

EDNS client subnet sent with every query, so CDNs pick servers near you even through the proxy. sing-box and hybrid only.

Type: null or string
Default: null
Example: "203.0.113.0/24"

services.proxy-suite.proxy.dns.fakeIp.enable

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.

Type: boolean
Default: false

services.proxy-suite.proxy.dns.fakeIp.inet4Range

Address range for fake IPs.

Type: string
Default: "198.18.0.0/15"

services.proxy-suite.proxy.dns.local

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.

Type: submodule
Default: { address = "1.1.1.1"; port = 53; type = "tcp"; }
Example: { address = "1.1.1.1"; port = 853; type = "tls"; }

services.proxy-suite.proxy.dns.local.address

Resolver address.

Type: string matching the pattern .+
Example: "1.1.1.1"

services.proxy-suite.proxy.dns.local.port

Resolver port.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 53

services.proxy-suite.proxy.dns.local.type

DNS transport.

Type: one of “udp”, “tcp”, “tls”
Default: "udp"

services.proxy-suite.proxy.dns.remote

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”.

Type: submodule
Default: { address = "1.1.1.1"; port = 53; type = "udp"; }
Example: { address = "1.1.1.1"; port = 853; type = "tls"; }

services.proxy-suite.proxy.dns.remote.address

Resolver address.

Type: string matching the pattern .+
Example: "1.1.1.1"

services.proxy-suite.proxy.dns.remote.port

Resolver port.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 53

services.proxy-suite.proxy.dns.remote.type

DNS transport.

Type: one of “udp”, “tcp”, “tls”
Default: "udp"

services.proxy-suite.proxy.dns.singBox.rules

DNS rules in sing-box JSON, checked before the generated ones. Unlike those, they stay active in the all-proxy and all-bypass modes.

Type: list of (attribute set)
Default: [ ]
Example: [ { domain_suffix = [ "corp.example" ]; server = "corp"; } ]

services.proxy-suite.proxy.dns.singBox.servers

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.

Type: list of (attribute set)
Default: [ ]
Example: [ { server = "10.0.0.53"; tag = "corp"; type = "udp"; } ]

services.proxy-suite.proxy.dns.strategy

Which IP versions to resolve. Use ipv4_only if the uplink has no IPv6. sing-box and hybrid only.

Type: null or one of “prefer_ipv4”, “prefer_ipv6”, “ipv4_only”, “ipv6_only”
Default: null
Example: "ipv4_only"

services.proxy-suite.proxy.ipv6

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.

Type: boolean
Default: config.networking.enableIPv6

services.proxy-suite.proxy.listener.address

Address of the local SOCKS5/HTTP proxy. Use “0.0.0.0” only to expose it to the network.

Type: string
Default: "127.0.0.1"

services.proxy-suite.proxy.listener.auth.password

Password for the local proxy. Ends up in the Nix store; prefer passwordFile.

Type: null or string matching the pattern [^[:space:]]+
Default: null
Example: "change-me"

services.proxy-suite.proxy.listener.auth.passwordFile

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.

Type: null or string
Default: null
Example: "/run/secrets/proxy-suite-local-proxy-password"

services.proxy-suite.proxy.listener.auth.username

Username for the local proxy. Needs password or passwordFile.

Type: null or string matching the pattern [^[:space:]]+
Default: null
Example: "proxy-user"

services.proxy-suite.proxy.listener.port

Port of the local SOCKS5/HTTP proxy.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 1080

services.proxy-suite.proxy.outbounds

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.

Type: list of (submodule)
Default: [ ]
Example:

[
  {
    tag = "de-vps";
    urlFile = "/run/secrets/proxy-de-url";
  }
  {
    tag = "nl-vps";
    url = "hy2://password@example.com:443?sni=example.com";
  }
]

services.proxy-suite.proxy.outbounds.*.backend

Which engine runs this outbound on the hybrid backend. “auto” uses sing-box, or XRay for XRay-only transports (XHTTP, ECH).

Type: one of “auto”, “sing-box”, “xray”
Default: "auto"
Example: "xray"

services.proxy-suite.proxy.outbounds.*.detour

Tag of an outbound that this outbound 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.

Type: null or string
Default: null
Example: "ru-vps"

services.proxy-suite.proxy.outbounds.*.routing.domains

Domains, with their subdomains, always sent to this outbound, whatever the selection.

Type: list of string
Default: [ ]
Example: [ "youtube.com" ]

services.proxy-suite.proxy.outbounds.*.routing.geoips

Geoip codes always sent to this outbound, whatever the selection; countries by default (see geodata).

Type: list of string
Default: [ ]
Example: [ "us" ]

services.proxy-suite.proxy.outbounds.*.routing.geosites

Geosite categories always sent to this outbound, whatever the selection (see geodata).

Type: list of string
Default: [ ]
Example: [ "netflix" ]

services.proxy-suite.proxy.outbounds.*.routing.ips

IP ranges (CIDR) always sent to this outbound, whatever the selection.

Type: list of string
Default: [ ]
Example: [ "1.1.1.0/24" ]

services.proxy-suite.proxy.outbounds.*.routing.ruleSets

Rule sets from proxy.routing.ruleSets always sent to this outbound, whatever the selection (sing-box and hybrid only).

Type: list of string
Default: [ ]
Example: [ "antifilter" ]

services.proxy-suite.proxy.outbounds.*.singBoxJson

Raw sing-box outbound JSON, instead of url (sing-box backend). Its tag is replaced.

Type: null or (attribute set)
Default: null
Example: { server = "example.com"; server_port = 443; type = "vless"; }

services.proxy-suite.proxy.outbounds.*.tag

Unique name, used in routing rules, detour and proxy-ctl. Not “proxy”, “direct” or “block”.

Type: string
Example: "vps-de"

services.proxy-suite.proxy.outbounds.*.url

Proxy link. Ends up in the Nix store; prefer urlFile.

Type: null or string
Default: null
Example: "hy2://password@example.com:443?sni=example.com"

services.proxy-suite.proxy.outbounds.*.urlFile

File with the proxy link.

Type: null or string
Default: null
Example: "/run/secrets/my-proxy-url"

services.proxy-suite.proxy.outbounds.*.xrayJson

Raw XRay outbound JSON, instead of url (XRay backend). Its tag is replaced.

Type: null or (attribute set)
Default: null
Example: { protocol = "vless"; settings = { address = "example.com"; }; }

services.proxy-suite.proxy.routing.block.domains

Domains, with their subdomains, to block.

Type: list of string
Default: [ ]
Example: [ "ads.example.com" ]

services.proxy-suite.proxy.routing.block.geoips

Geoip codes to block.

Type: list of string
Default: [ ]
Example: [ "cn" ]

services.proxy-suite.proxy.routing.block.geosites

Geosite categories to block.

Type: list of string
Default: [ ]
Example: [ "category-ads-all" ]

services.proxy-suite.proxy.routing.block.ips

IP ranges (CIDR) to block.

Type: list of string
Default: [ ]
Example: [ "203.0.113.0/24" ]

services.proxy-suite.proxy.routing.block.ruleSets

Rule sets from ruleSets to block.

Type: list of string
Default: [ ]
Example: [ "ads" ]

services.proxy-suite.proxy.routing.default

Where traffic goes when no rule matches.

Type: one of “proxy”, “direct”
Default: "proxy"
Example: "direct"

services.proxy-suite.proxy.routing.direct.domains

Domains, with their subdomains, sent direct. zapret.directSync adds zapret’s domains.

Type: list of string
Default: [ ]
Example: [ "internal.example" ]

services.proxy-suite.proxy.routing.direct.geoips

Geoip codes sent direct.

Type: list of string
Default: [ ]
Example: [ "ru" ]

services.proxy-suite.proxy.routing.direct.geosites

Geosite categories sent direct.

Type: list of string
Default: [ ]
Example: [ "category-ru" ]

services.proxy-suite.proxy.routing.direct.ips

IP ranges (CIDR) sent direct.

Type: list of string
Default: [ ]
Example: [ "10.10.0.0/16" ]

services.proxy-suite.proxy.routing.direct.ruleSets

Rule sets from ruleSets sent direct.

Type: list of string
Default: [ ]
Example: [ "ru-services" ]

services.proxy-suite.proxy.routing.directRu

Send Russian sites and IPs (geosite “category-ru”, geoip “ru”) direct.

Type: boolean
Default: true

services.proxy-suite.proxy.routing.proxy.domains

Domains, with their subdomains, sent through the proxy.

Type: list of string
Default: [ ]
Example: [ "youtube.com" ]

services.proxy-suite.proxy.routing.proxy.geoips

Geoip codes sent through the proxy.

Type: list of string
Default: [ ]
Example: [ "us" ]

services.proxy-suite.proxy.routing.proxy.geosites

Geosite categories sent through the proxy.

Type: list of string
Default: [ ]
Example: [ "netflix" ]

services.proxy-suite.proxy.routing.proxy.ips

IP ranges (CIDR) sent through the proxy.

Type: list of string
Default: [ ]
Example: [ "1.1.1.0/24" ]

services.proxy-suite.proxy.routing.proxy.ruleSets

Rule sets from ruleSets sent through the proxy.

Type: list of string
Default: [ ]
Example: [ "antifilter" ]

services.proxy-suite.proxy.routing.ruleSetUpdateInterval

How often rule sets are refreshed (systemd time span).

Type: string
Default: "1d"
Example: "6h"

services.proxy-suite.proxy.routing.ruleSets

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.

Type: attribute set of (submodule)
Default: { }
Example: { antifilter = { url = "https://example.com/antifilter.srs"; }; }

services.proxy-suite.proxy.routing.ruleSets.<name>.detour

Download through the proxy or directly.

Type: one of “proxy”, “direct”
Default: "proxy"

services.proxy-suite.proxy.routing.ruleSets.<name>.format

“binary” (.srs) or “source” (JSON). null: guess from the URL.

Type: null or one of “binary”, “source”
Default: null

services.proxy-suite.proxy.routing.ruleSets.<name>.url

URL of the sing-box rule set.

Type: string matching the pattern https?://.+
Example: "https://example.com/antifilter.srs"

services.proxy-suite.proxy.routing.rules

Rules checked in order before the proxy, direct and block lists. The first match wins.

Type: list of (submodule)
Default: [ ]
Example:

[
  {
    geosites = [
      "netflix"
    ];
    outbound = "vps-de";
  }
  {
    domains = [
      "internal.corp"
    ];
    outbound = "direct";
  }
]

services.proxy-suite.proxy.routing.rules.*.domains

Domains, with their subdomains, that this rule matches.

Type: list of string
Default: [ ]
Example: [ "youtube.com" ]

services.proxy-suite.proxy.routing.rules.*.geoips

Geoip codes that this rule matches; countries by default (see geodata).

Type: list of string
Default: [ ]
Example: [ "us" ]

services.proxy-suite.proxy.routing.rules.*.geosites

Geosite categories that this rule matches (see geodata).

Type: list of string
Default: [ ]
Example: [ "netflix" ]

services.proxy-suite.proxy.routing.rules.*.ips

IP ranges (CIDR) that this rule matches.

Type: list of string
Default: [ ]
Example: [ "1.1.1.0/24" ]

services.proxy-suite.proxy.routing.rules.*.outbound

Outbound tag, or “proxy”, “direct” or “block”.

Type: string
Example: "vps-de"

services.proxy-suite.proxy.routing.rules.*.ruleSets

Rule sets from proxy.routing.ruleSets that this rule matches (sing-box and hybrid only).

Type: list of string
Default: [ ]
Example: [ "antifilter" ]

services.proxy-suite.proxy.selection

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 works in every mode and survives restarts. On sing-box, “selector” and “urltest” switch without restarting the backend.

Type: one of “first”, “selector”, “urltest”
Default: "first"
Example: "urltest"

services.proxy-suite.proxy.selectionExclude

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.

Type: list of string
Default: [ ]
Example: [ "ru-vps" "warp" ]

services.proxy-suite.proxy.singBox.package

sing-box package, for the “sing-box” and “hybrid” backends.

Type: package
Default: sing-box from proxy-suite’s own nixpkgs input
Example: pkgs.sing-box

services.proxy-suite.proxy.singBox.clashApiPort

Loopback port of the sing-box Clash API, used to switch and test outbounds.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 9090

services.proxy-suite.proxy.subscriptionUpdateInterval

How often subscriptions are refreshed (systemd time span).

Type: string
Default: "1d"
Example: "6h"

services.proxy-suite.proxy.subscriptions

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.

Type: list of (submodule)
Default: [ ]
Example: [ { tag = "private"; urlFile = "/run/secrets/private-sub-url"; } ]

services.proxy-suite.proxy.subscriptions.*.detour

Tag of an outbound that every entry of this subscription 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.

Type: null or string
Default: null
Example: "ru-vps"

services.proxy-suite.proxy.subscriptions.*.tag

Unique name, used as a prefix for the tags of its outbounds.

Type: string matching the pattern ^[A-Za-z0-9][A-Za-z0-9._-]*$
Example: "community-list"

services.proxy-suite.proxy.subscriptions.*.url

Subscription URL. Ends up in the Nix store; prefer urlFile.

Type: null or string
Default: null
Example: "https://example.com/sub/token123"

services.proxy-suite.proxy.subscriptions.*.urlFile

File with the subscription URL.

Type: null or string
Default: null
Example: "/run/secrets/proxy-subscription-url"

services.proxy-suite.proxy.tproxy.enable

Whether to enable global TProxy mode.

Type: boolean
Default: false

services.proxy-suite.proxy.tproxy.fwmark

Firewall mark for intercepted packets.

Type: signed integer
Default: 1

services.proxy-suite.proxy.tproxy.lanInterfaces

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.

Type: list of string
Default: [ ]
Example: [ "br0" ]

services.proxy-suite.proxy.tproxy.localSubnets

Subnets that skip the proxy, such as your LAN and VM bridges (DNS still goes through it). IPv6 works too.

Type: list of string
Default: [ "192.168.0.0/16" ]
Example: [ "192.168.0.0/16" "10.0.0.0/8" "fd00::/8" ]

services.proxy-suite.proxy.tproxy.port

Local port that intercepted traffic is redirected to.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default: 1085

services.proxy-suite.proxy.tproxy.proxyMark

Firewall mark for the proxy’s own traffic, so it is not intercepted again.

Type: signed integer
Default: 2

services.proxy-suite.proxy.tproxy.routeTable

Routing table for intercepted traffic.

Type: signed integer
Default: 100

services.proxy-suite.proxy.tun.enable

Whether to enable global TUN mode.

Type: boolean
Default: false

services.proxy-suite.proxy.tun.address

TUN interface address (CIDR).

Type: string
Default: "172.19.0.1/30"

services.proxy-suite.proxy.tun.interface

TUN interface name.

Type: string
Default: "singtun0"

services.proxy-suite.proxy.tun.mtu

TUN interface MTU.

Type: signed integer
Default: 1400

services.proxy-suite.proxy.urlTest.interval

How often outbounds are tested (Go duration).

Type: string
Default: "3m"
Example: "1m"

services.proxy-suite.proxy.urlTest.tolerance

How many milliseconds faster an outbound must be to replace the current one (sing-box only).

Type: signed integer
Default: 50
Example: 100

services.proxy-suite.proxy.urlTest.url

URL used to test outbounds. Pick one that is blocked in your region.

Type: string
Default: "https://www.gstatic.com/generate_204"
Example: "https://telegram.org"

services.proxy-suite.proxy.xray.package

XRay package, for the “xray” and “hybrid” backends.

Type: package
Default: proxy-suite’s xray (pkgs/xray.nix)
Example: pkgs.xray