diff --git a/README.md b/README.md index b7301db..65944cc 100644 --- a/README.md +++ b/README.md @@ -120,4 +120,4 @@ services.proxy-suite = { To see options and documentation, check out the [options reference](./docs/options.md). -Options are autogenerated from [options.nix](./modules/proxy-suite/options.nix) using `nix run .#update-options-doc`. +Options are autogenerated from [options/default.nix](./modules/proxy-suite/options/default.nix) using `nix run .#update-options-doc`. diff --git a/docs/options.md b/docs/options.md index 3e0b437..2c834a5 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1,6 +1,6 @@ # proxy-suite options -This file is generated from the `services.proxy-suite` option descriptions in [`modules/proxy-suite/options.nix`](modules/proxy-suite/options.nix). +This file is generated from the `services.proxy-suite` option descriptions in [`modules/proxy-suite/options/default.nix`](/modules/proxy-suite/options/default.nix). Update module option docs there instead of editing this file by hand. ## Table of contents @@ -605,7 +605,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -638,7 +638,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -669,7 +669,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -703,7 +703,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -742,7 +742,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -775,7 +775,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -808,7 +808,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -842,7 +842,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -876,7 +876,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -910,7 +910,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -949,7 +949,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -982,7 +982,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1015,7 +1015,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1048,7 +1048,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1082,7 +1082,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1117,7 +1117,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1168,7 +1168,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1232,7 +1232,7 @@ list of (submodule) ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1258,7 +1258,7 @@ string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$ ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1305,7 +1305,7 @@ one of “direct”, “proxychains”, “tun”, “tproxy”, “zapret” ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1338,7 +1338,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1373,7 +1373,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1407,7 +1407,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/app-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/app-routing.nix) @@ -1434,7 +1434,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1469,7 +1469,7 @@ Only used when selection is “selector” or “urltest”\. Ignored in ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1516,7 +1516,7 @@ submodule ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1541,7 +1541,7 @@ string matching the pattern \.+ ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1574,7 +1574,7 @@ Destination port for this DNS upstream\. ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1607,7 +1607,7 @@ one of “udp”, “tcp”, “tls” ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1651,7 +1651,7 @@ submodule ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1676,7 +1676,7 @@ string matching the pattern \.+ ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1709,7 +1709,7 @@ Destination port for this DNS upstream\. ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1742,7 +1742,7 @@ one of “udp”, “tcp”, “tls” ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1777,7 +1777,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1814,7 +1814,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1860,7 +1860,7 @@ list of (submodule) ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1904,7 +1904,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1941,7 +1941,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -1978,7 +1978,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2015,7 +2015,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2051,7 +2051,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2081,7 +2081,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2118,7 +2118,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2155,7 +2155,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2189,7 +2189,7 @@ proxy-suite-socks\. ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2226,7 +2226,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2260,7 +2260,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2295,7 +2295,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2331,7 +2331,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2366,7 +2366,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2401,7 +2401,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2436,7 +2436,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2471,7 +2471,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2508,7 +2508,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2544,7 +2544,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2580,7 +2580,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2617,7 +2617,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2654,7 +2654,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2691,7 +2691,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2728,7 +2728,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2764,7 +2764,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2827,7 +2827,7 @@ list of (submodule) ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2864,7 +2864,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2901,7 +2901,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2938,7 +2938,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -2974,7 +2974,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3005,7 +3005,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3053,7 +3053,7 @@ one of “first”, “selector”, “urltest” ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3091,7 +3091,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3143,7 +3143,7 @@ list of (submodule) ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3170,7 +3170,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3208,7 +3208,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3245,7 +3245,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3278,7 +3278,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3313,7 +3313,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3355,7 +3355,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3390,7 +3390,7 @@ TCP/UDP traffic to this port\. ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3423,7 +3423,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3456,7 +3456,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3491,7 +3491,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3524,7 +3524,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3557,7 +3557,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3592,7 +3592,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3628,7 +3628,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3667,7 +3667,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix) @@ -3700,7 +3700,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3739,7 +3739,7 @@ attribute set of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3774,7 +3774,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3809,7 +3809,7 @@ WebSocket proxy\. ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3846,7 +3846,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3882,7 +3882,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3915,7 +3915,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3949,7 +3949,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -3984,7 +3984,7 @@ signed integer ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -4020,7 +4020,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -4055,7 +4055,7 @@ string matching the pattern ^\[a-z_]\[a-z0-9_-]\*$ ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -4091,7 +4091,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/other\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/other.nix) @@ -4122,7 +4122,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4155,7 +4155,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4193,7 +4193,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4226,7 +4226,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4259,7 +4259,7 @@ string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4317,7 +4317,7 @@ list of (submodule) ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4343,7 +4343,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4380,7 +4380,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4406,7 +4406,7 @@ string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$ ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4444,7 +4444,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4478,7 +4478,7 @@ null ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4516,7 +4516,7 @@ false ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4553,7 +4553,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4590,7 +4590,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4627,7 +4627,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4664,7 +4664,7 @@ list of string ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4701,7 +4701,7 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4735,7 +4735,7 @@ false ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) @@ -4769,6 +4769,6 @@ true ``` *Declared by:* - - [modules/proxy-suite/options\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options.nix) + - [modules/proxy-suite/options/zapret\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/zapret.nix) diff --git a/flake.nix b/flake.nix index 7a7109b..d9cdfe6 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,7 @@ update-options-doc = { type = "app"; program = "${self.packages.${system}.update-options-doc}/bin/update-options-doc"; + meta.description = "Update docs/options.md from the current NixOS module option declarations"; }; }); diff --git a/modules/proxy-suite/default.nix b/modules/proxy-suite/default.nix index eb2ecab..8c05422 100644 --- a/modules/proxy-suite/default.nix +++ b/modules/proxy-suite/default.nix @@ -15,7 +15,7 @@ let in { imports = [ - ./options.nix + ./options ]; config = lib.mkIf cfg.enable ( diff --git a/modules/proxy-suite/options.nix b/modules/proxy-suite/options.nix deleted file mode 100644 index a395d9a..0000000 --- a/modules/proxy-suite/options.nix +++ /dev/null @@ -1,1309 +0,0 @@ -# All option declarations for services.proxy-suite -{ config, lib, ... }: - -let - inherit (lib) mkOption mkEnableOption types; - - # Shared routing-rule fields (reused in both outboundType.routing and routing.rules entries) - routingFields = { - domains = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Domain suffixes to match in this routing rule. - Leave empty to skip domain-based matching for this rule entry. - ''; - example = [ - "youtube.com" - "discord.com" - ]; - }; - ips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - IP CIDRs to match in this routing rule. - Leave empty to skip IP-based matching for this rule entry. - ''; - example = [ "1.1.1.0/24" ]; - }; - geosites = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - sing-geosite rule-set names to match in this routing rule. - Each name becomes a sing-box geosite rule-set reference. - ''; - example = [ - "netflix" - "google" - ]; - }; - geoips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - sing-geoip rule-set names to match in this routing rule. - Each name becomes a sing-box geoip rule-set reference. - ''; - example = [ - "us" - "de" - ]; - }; - }; - - # An explicit routing rule – associates traffic patterns with a named outbound. - routingRuleType = types.submodule { - options = { - outbound = mkOption { - type = types.str; - description = '' - Target outbound tag. Can be a specific server tag (only useful with - selection = "selector" or "urltest"), or one of the built-in tags: - "proxy" (the active proxy outbound), "direct", "block". - - With selection = "first", named proxy outbounds are collapsed into the - single active "proxy" outbound at runtime, so per-tag routing no longer - distinguishes between individual proxy servers. - ''; - example = "vps-de"; - }; - } - // routingFields; - }; - - subscriptionType = types.submodule { - options = { - tag = mkOption { - type = types.str; - description = '' - Unique identifier for this subscription. - Used as a prefix for all outbound tags generated from its proxy list, - e.g. "my-sub" -> tags like "my-sub-Server-DE". - ''; - example = "community-list"; - }; - - url = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Literal subscription URL. The response must be a base64-encoded - newline-separated list of proxy URIs (standard v2rayN format) or - a plain-text list of the same. - - This value is embedded in the Nix store. Prefer urlFile for private - subscription links or tokens. - ''; - example = "https://example.com/sub/token123"; - }; - - urlFile = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Runtime path to a file containing the subscription URL. - Intended for use with secret managers (sops-nix, agenix, etc.). - The file is read at service start time and never lands in the Nix store. - - Set exactly one of urlFile or url for each subscription entry. - ''; - example = "/run/secrets/proxy-subscription-url"; - }; - }; - }; - - outboundType = types.submodule { - options = { - tag = mkOption { - type = types.str; - description = '' - Outbound tag used in routing rules and multi-outbound selection. - - With selection = "selector" or "urltest", each outbound keeps its own - tag and can be selected directly. With selection = "first", sing-box - routes through a single active outbound tagged "proxy", so individual - proxy tags are mainly useful for documentation and config structure. - ''; - example = "vps-de"; - }; - - urlFile = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Runtime path to a file containing the proxy URL. - Intended for use with secret managers (sops-nix, agenix, etc.). - The file is read at service start time and never lands in the Nix store. - - Set exactly one of urlFile, url, or json for each outbound. - ''; - example = "/run/secrets/my-proxy-url"; - }; - - url = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Literal proxy URL. Convenient for non-secret configs, but the URL - will end up in the Nix store. - - Set exactly one of urlFile, url, or json for each outbound. - Prefer urlFile for real credentials. - ''; - example = "hy2://password@example.com:443?sni=example.com"; - }; - - json = mkOption { - type = types.nullOr types.attrs; - default = null; - description = '' - Raw sing-box outbound configuration as a Nix attribute set. - Embedded directly into the config at build time. The tag field - is overridden by the outbound's tag option. - - Set exactly one of urlFile, url, or json for each outbound. - Use this when the proxy definition is easier to generate as native Nix - than as a single URL string. - ''; - example = { - type = "vless"; - server = "example.com"; - server_port = 443; - uuid = "..."; - }; - }; - - # Shorthand for attaching routing rules directly to an outbound definition. - # Traffic matching these patterns is sent to this specific outbound. - # Only meaningful when selection = "selector" or "urltest" (with "first", - # all proxy traffic goes to the single "proxy" outbound anyway). - routing = routingFields; - }; - }; - - dnsUpstreamType = types.submodule { - options = { - type = mkOption { - type = types.enum [ - "udp" - "tcp" - "tls" - ]; - default = "udp"; - description = '' - sing-box DNS transport type for this upstream resolver. - ''; - example = "tls"; - }; - - address = mkOption { - type = types.strMatching ".+"; - description = '' - Resolver address or hostname used for this DNS upstream. - ''; - example = "1.1.1.1"; - }; - - port = mkOption { - type = types.port; - default = 53; - description = '' - Destination port for this DNS upstream. - ''; - example = 853; - }; - }; - }; - - zapretPresetType = types.enum [ - "general" - "google" - "instagram" - "soundcloud" - "twitter" - ]; - - zapretHostlistRuleType = types.submodule { - options = { - name = mkOption { - type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; - description = '' - Custom hostlist name. Used to generate hostlists/list-.txt - inside the derived zapret config directory. - ''; - example = "cloudflare"; - }; - - domains = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Domains written into the generated custom zapret hostlist file. - Must be non-empty for every hostlistRules entry. - ''; - example = [ - "example.com" - "example.de" - ]; - }; - - preset = mkOption { - type = types.nullOr zapretPresetType; - default = null; - description = '' - Clone the active zapret config's built-in NFQWS rule family for this - hostlist. Can be combined with nfqwsArgs for additional custom rules. - ''; - example = "google"; - }; - - nfqwsArgs = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Additional NFQWS argument fragments for this hostlist. - The module injects --hostlist=... and trailing --new automatically. - - Each hostlistRules entry must define preset, nfqwsArgs, or both. - ''; - example = [ - "--filter-tcp=443 --dpi-desync=fake,multisplit" - ]; - }; - - enableDirectSync = mkOption { - type = types.bool; - default = true; - description = '' - Whether this custom hostlist should also be mirrored into sing-box - direct domain routing when zapret.syncDirectRouting = true. - ''; - }; - }; - }; - - appRoutingProfileType = types.submodule { - options = { - name = mkOption { - type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; - description = '' - Profile name used by `proxy-ctl wrap -- `. - Must be unique within appRouting.profiles. - ''; - example = "steam-browser"; - }; - - route = mkOption { - type = types.enum [ - "direct" - "proxychains" - "tun" - "tproxy" - "zapret" - ]; - default = "proxychains"; - description = '' - Per-app route backend used by proxy-ctl wrap. - - - "direct": run the command unchanged. - - "proxychains": run the command through proxychains-ng using the - local proxy-suite mixed SOCKS endpoint. - - "tun": launch the command in the dedicated app-routing TUN slice so - only that app's traffic is policy-routed into the app TUN backend. - - "tproxy": launch the command in the dedicated app-routing TProxy - slice so only that app's traffic is transparently intercepted by - the local sing-box TProxy inbound. - - "zapret": launch the command in the dedicated app-routing zapret - slice so only that app's traffic is handled by the separate - app-scoped zapret instance. - - Additional route backends may be added in the future. - ''; - example = "proxychains"; - }; - }; - }; - -in -{ - options.services.proxy-suite = { - enable = mkEnableOption "proxy suite (sing-box + zapret + tg-ws-proxy)"; - - userControl = { - group = mkOption { - type = types.strMatching "^[a-z_][a-z0-9_-]*$"; - default = "proxy-suite"; - description = '' - Local group allowed to use passwordless polkit-backed `proxy-ctl` - commands when userControl.global.enable or userControl.perApp.enable - is turned on. - ''; - example = "proxy-suite"; - }; - - global.enable = - (mkEnableOption "passwordless proxy-ctl control over global proxy-suite units") - // { - default = true; - description = '' - Whether members of userControl.group may manage global - proxy-suite units without password prompts via commands like - `proxy-ctl tun on|off`, `proxy-ctl tproxy on|off`, - `proxy-ctl restart`, or `proxy-ctl subscription update`. - ''; - }; - - perApp.enable = - (mkEnableOption "passwordless proxy-ctl control over per-app routing helpers") - // { - default = true; - description = '' - Whether members of userControl.group may start and stop the - app-scoped backend units used by `proxy-ctl wrap ...` for - route = "tun", route = "tproxy", or route = "zapret" profiles - without password prompts. - ''; - }; - }; - - singBox = { - enable = mkOption { - type = types.bool; - default = true; - description = '' - Whether to configure and run sing-box services for proxy-suite. - When disabled, singBox.* options are ignored even if proxy-suite itself - is enabled. - ''; - }; - - outbounds = mkOption { - type = types.listOf outboundType; - default = [ ]; - description = '' - List of static proxy outbounds. - Set exactly one of urlFile, url, or json per entry. - - At least one outbound or one subscription is required when - singBox.enable = true. - ''; - example = [ - { - tag = "de-vps"; - urlFile = "/run/secrets/proxy-de-url"; - } - { - tag = "nl-vps"; - url = "hy2://password@example.com:443?sni=example.com"; - } - ]; - }; - - subscriptions = mkOption { - type = types.listOf subscriptionType; - default = [ ]; - description = '' - Subscription URLs that provide dynamic lists of proxy outbounds. - Each URL must return a base64-encoded newline-separated list of proxy URIs - (standard v2rayN / Clash subscription format) or plain text of the same. - - On first service start, each subscription is fetched live and cached - under /var/lib/proxy-suite/subscriptions/.json. Later restarts - reuse the cache, so ordinary service restarts do not need network access. - - A systemd timer (proxy-suite-subscription-update) refreshes all caches on - the interval set by subscriptionUpdateInterval and restarts the running - sing-box services after a successful refresh. - ''; - example = [ - { - tag = "community"; - url = "https://example.com/sub/token"; - } - { - tag = "private"; - urlFile = "/run/secrets/private-sub-url"; - } - ]; - }; - - subscriptionUpdateInterval = mkOption { - type = types.str; - default = "1d"; - description = '' - How often the proxy-suite-subscription-update timer fires and refreshes - all subscription caches. Accepts any systemd time span string - (e.g. "1h", "6h", "1d", "12h"). - - Only used when singBox.subscriptions is non-empty. The timer also runs - once shortly after boot. - ''; - example = "6h"; - }; - - selection = mkOption { - type = types.enum [ - "first" - "selector" - "urltest" - ]; - default = "first"; - description = '' - How to pick between multiple proxy outbounds: - - - "first": route through a single active outbound tagged "proxy". - The first static outbound is used, or the first subscription - outbound if only subscriptions are configured. - - "selector": create a Clash-compatible selector outbound tagged - "proxy" and keep all configured outbounds available for manual - switching via the Clash API. - - "urltest": create an automatic latency-testing outbound tagged - "proxy" and keep all configured outbounds available so sing-box - can periodically probe and switch to a faster one. - - clashApiPort is only used with "selector" or "urltest". - urlTest.* options are only used with "urltest". - Per-outbound tags are only individually meaningful with "selector" - or "urltest". - ''; - example = "urltest"; - }; - - urlTest = { - url = mkOption { - type = types.str; - default = "https://www.gstatic.com/generate_204"; - description = '' - URL that sing-box fetches through each proxy to measure latency. - Only used when selection = "urltest". - - Set this to a URL that is actually blocked in your region (e.g. - "https://telegram.org") so that only proxies that bypass the - blocking get selected. If left at the default, any responding proxy - wins – including ones that might not unblock your target site. - ''; - example = "https://telegram.org"; - }; - - interval = mkOption { - type = types.str; - default = "3m"; - description = '' - How often sing-box re-tests all outbounds. Accepts a Go duration - string (e.g. "1m", "3m", "10m"). - Only used when selection = "urltest". - ''; - example = "1m"; - }; - - tolerance = mkOption { - type = types.int; - default = 50; - description = '' - Latency tolerance in milliseconds. The current proxy is only replaced - when a competing one is faster by more than this value. - - Only used when selection = "urltest". - ''; - example = 100; - }; - }; - - clashApiPort = mkOption { - type = types.port; - default = 9090; - description = '' - Port for the Clash-compatible REST API exposed by sing-box. - Only used when selection is "selector" or "urltest". Ignored in - "first" mode because there is no selector-style outbound to control. - ''; - example = 9090; - }; - - listenAddress = mkOption { - type = types.str; - default = "127.0.0.1"; - description = '' - Address for the SOCKS5/HTTP mixed inbound to bind to. - This affects the always-on proxy-suite-socks service. - - Use "0.0.0.0" only if you intentionally want to expose the proxy to - other machines on your network. - ''; - example = "127.0.0.1"; - }; - - port = mkOption { - type = types.port; - default = 1080; - description = '' - Listen port for the always-on SOCKS5/HTTP mixed inbound provided by - proxy-suite-socks. - ''; - example = 1080; - }; - - tproxyPort = mkOption { - type = types.port; - default = 1081; - description = '' - Local listen port for sing-box's TProxy inbound. - nftables redirection created by proxy-suite-tproxy sends intercepted - TCP/UDP traffic to this port. - ''; - example = 1081; - }; - - fwmark = mkOption { - type = types.int; - default = 1; - description = '' - Mark applied to intercepted packets in TProxy mode. - A matching `ip rule` routes this mark to singBox.routeTable, which - points traffic to loopback for local proxy processing. - ''; - example = 1; - }; - - proxyMark = mkOption { - type = types.int; - default = 2; - description = '' - Mark applied to sing-box egress packets in TProxy mode so they bypass - re-interception and do not loop back into the transparent proxy path. - ''; - example = 2; - }; - - routeTable = mkOption { - type = types.int; - default = 100; - description = '' - Policy-routing table number used for TProxy interception flow. - The module installs a local default route in this table and binds it - to singBox.fwmark. - ''; - example = 100; - }; - - proxyByDefault = mkOption { - type = types.bool; - default = true; - description = '' - Whether traffic that does not match any explicit routing rule should - go through the proxy or go direct. - - This affects sing-box route.final and dns.final in the generated - config. - ''; - example = true; - }; - - dns = { - local = mkOption { - type = dnsUpstreamType; - default = { - type = "udp"; - address = "1.1.1.1"; - port = 53; - }; - description = '' - DNS upstream used for the built-in "local" resolver role. - This resolver is also used as sing-box route.default_domain_resolver. - - The module keeps detour policy automatic: in mixed/TProxy mode and - app-routing TUN mode, "local" stays on the direct path (without an - explicit detour); in global TUN mode, it is forced through the proxy to avoid - auto_redirect conflicts. - ''; - example = { - type = "tcp"; - address = "9.9.9.9"; - port = 53; - }; - }; - - remote = mkOption { - type = dnsUpstreamType; - default = { - type = "udp"; - address = "1.1.1.1"; - port = 53; - }; - description = '' - DNS upstream used for the built-in "remote" resolver role. - - This resolver always detours through the proxy and becomes the - generated dns.final target when singBox.proxyByDefault = true. - ''; - example = { - type = "tls"; - address = "1.1.1.1"; - port = 853; - }; - }; - }; - - tun = { - enable = mkEnableOption "TUN mode service (opt-in, mutually exclusive with proxy-suite-tproxy)"; - - autostart = mkOption { - type = types.bool; - default = false; - description = '' - Whether to start proxy-suite-tun automatically during boot by - attaching it to multi-user.target. - Cannot be enabled together with singBox.tproxy.autostart. - ''; - example = true; - }; - - interface = mkOption { - type = types.str; - default = "singtun0"; - description = "Name of the TUN interface created by proxy-suite-tun."; - example = "singtun0"; - }; - - address = mkOption { - type = types.str; - default = "172.19.0.1/30"; - description = "Address assigned to the TUN interface in CIDR notation."; - example = "172.19.0.1/30"; - }; - - mtu = mkOption { - type = types.int; - default = 1400; - description = "MTU for the TUN interface created by proxy-suite-tun."; - example = 1400; - }; - }; - - tproxy = { - enable = mkEnableOption "TProxy mode service (opt-in, transparent proxy via nftables)"; - - autostart = mkOption { - type = types.bool; - default = false; - description = '' - Whether to start proxy-suite-tproxy automatically during boot by - attaching it to multi-user.target. - Cannot be enabled together with singBox.tun.autostart. - ''; - example = true; - }; - - localSubnets = mkOption { - type = types.listOf types.str; - default = [ "192.168.0.0/16" ]; - description = '' - Subnets whose traffic bypasses TProxy interception, except DNS (port 53). - - Typically this should include your LAN subnet(s). VM bridge networks - should usually go here too, or use zapret.cidrExemption for - subnet-specific NFQUEUE exemption on the zapret side. - ''; - example = [ - "192.168.0.0/16" - "10.0.0.0/8" - ]; - }; - }; - - routing = { - enableRuDirect = mkOption { - type = types.bool; - default = true; - description = '' - Automatically append "category-ru" to routing.direct.geosites and - "ru" to routing.direct.geoips. - - This is additive: user-defined routing.direct.* entries still apply. - ''; - example = true; - }; - - proxy = routingFields; - - direct = { - domains = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Domain suffixes to send direct (bypass proxy). - Merged with zapret-synced direct domains when zapret direct sync - options are enabled. - ''; - example = [ "internal.example" ]; - }; - ips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - IP CIDRs to send direct. - Merged with zapret-synced direct IPs when the corresponding zapret - sync options are enabled. - ''; - example = [ "10.10.0.0/16" ]; - }; - geosites = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - sing-geosite names to send direct. - "category-ru" is added automatically when enableRuDirect = true. - ''; - example = [ "category-ru" ]; - }; - geoips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - sing-geoip names to send direct. - "ru" is added automatically when enableRuDirect = true. - ''; - example = [ "ru" ]; - }; - }; - - block = { - domains = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Domain suffixes to block entirely."; - example = [ "ads.example.com" ]; - }; - ips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "IP CIDRs to block."; - example = [ "203.0.113.0/24" ]; - }; - geosites = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "sing-geosite names to block."; - example = [ "category-ads-all" ]; - }; - geoips = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "sing-geoip names to block."; - example = [ "cn" ]; - }; - }; - - # Per-outbound routing rules evaluated before global proxy/direct/block lists. - # Equivalent to setting outbound.routing.* directly on each outbound definition. - rules = mkOption { - type = types.listOf routingRuleType; - default = [ ]; - description = '' - Explicit routing rules evaluated before global proxy/direct/block lists. - Each rule routes matching traffic to a specific outbound tag. - - The outbound can be a configured outbound tag (useful with selector/urltest), - or one of: "proxy" (active proxy), "direct", "block". - - Order is preserved. The first matching rule wins in sing-box. - With selection = "first", non-built-in outbound tags are effectively - routed to the single active "proxy" outbound. - ''; - example = [ - { - outbound = "vps-de"; - domains = [ "netflix.com" ]; - geosites = [ "netflix" ]; - } - { - outbound = "direct"; - domains = [ "internal.corp" ]; - } - { - outbound = "block"; - domains = [ "ads.example.com" ]; - } - ]; - }; - }; - }; - - appRouting = { - enable = mkEnableOption "per-app routing helpers via proxy-ctl wrap"; - - createDefaultProfiles = mkOption { - type = types.bool; - default = false; - description = '' - Whether to automatically add curated appRouting profiles. - - This is opt-in. Generated defaults are appended only when no - user-defined profile with the same name already exists. - - Current curated defaults: - - `proxychains`: route = "proxychains" - - `tun`: route = "tun" when appRouting.backends.tun.enable = true - - `tproxy`: route = "tproxy" when appRouting.backends.tproxy.enable = true - - `zapret`: route = "zapret" when appRouting.backends.zapret.enable = true - and zapret.enable = true - - This makes `proxy-ctl wrap proxychains -- ` available - without defining the profile manually, and similarly exposes - `proxy-ctl wrap tun -- ` or - `proxy-ctl wrap tproxy -- ` or - `proxy-ctl wrap zapret -- ` when the corresponding backend - is enabled. - ''; - example = true; - }; - - profiles = mkOption { - type = types.listOf appRoutingProfileType; - default = [ ]; - description = '' - Named per-app route profiles consumed by `proxy-ctl wrap`. - - This initial implementation supports: - - "direct" for running a command unchanged - - "proxychains" for TCP apps that can use an LD_PRELOAD wrapper - instead of global TUN or TProxy interception - - "tun" for app-scoped policy routing into the dedicated app TUN - backend - - "tproxy" for app-scoped transparent interception through the - dedicated app TProxy backend - - "zapret" for app-scoped zapret handling through a separate - zapret instance without changing the app's network path or exit IP - - proxychains-based wrapping depends on the local proxy-suite mixed - proxy listener provided by sing-box. The "tun" route depends on - appRouting.backends.tun.enable = true. The "tproxy" route depends on - appRouting.backends.tproxy.enable = true. The "zapret" route depends - on appRouting.backends.zapret.enable = true and zapret.enable = true. - - When createDefaultProfiles = true, curated defaults are added on top - of this list unless a user-defined profile already uses the same - name. - ''; - example = [ - { - name = "steam-browser"; - route = "proxychains"; - } - { - name = "native-direct"; - route = "direct"; - } - ]; - }; - - proxychains = { - enable = mkEnableOption "proxychains-backed appRouting profiles"; - - quiet = mkOption { - type = types.bool; - default = true; - description = '' - Whether generated proxychains wrappers should suppress their normal - startup chatter. This maps to proxychains-ng quiet_mode. - ''; - example = true; - }; - - proxyDns = mkOption { - type = types.bool; - default = true; - description = '' - Whether generated proxychains wrappers should resolve DNS through - the proxy instead of the local resolver. This maps to proxychains-ng - proxy_dns. - ''; - example = true; - }; - }; - - backends = { - tun = { - enable = mkEnableOption "app-scoped TUN backend for appRouting profiles"; - - interface = mkOption { - type = types.str; - default = "psapptun0"; - description = '' - Name of the dedicated app-routing TUN interface used by - proxy-suite-app-tun. - ''; - example = "psapptun0"; - }; - - address = mkOption { - type = types.str; - default = "172.20.0.1/30"; - description = '' - Address assigned to the app-routing TUN interface in CIDR - notation. - ''; - example = "172.20.0.1/30"; - }; - - mtu = mkOption { - type = types.int; - default = 1400; - description = '' - MTU for the app-routing TUN interface. - ''; - example = 1400; - }; - - fwmark = mkOption { - type = types.int; - default = 16; - description = '' - Packet mark used to steer wrapped app traffic into the app-routing - TUN policy-routing table. - ''; - example = 16; - }; - - routeTable = mkOption { - type = types.int; - default = 101; - description = '' - Policy-routing table used by the app-routing TUN backend. - ''; - example = 101; - }; - - localSubnets = mkOption { - type = types.listOf types.str; - default = [ "192.168.0.0/16" ]; - description = '' - Destination subnets that should bypass the app-routing TUN mark, - so wrapped apps can still reach local LAN resources directly. - ''; - example = [ - "192.168.0.0/16" - "10.0.0.0/8" - ]; - }; - }; - - tproxy = { - enable = mkEnableOption "app-scoped TProxy backend for appRouting profiles"; - - fwmark = mkOption { - type = types.int; - default = 17; - description = '' - Packet mark used to steer wrapped app traffic into the app-routing - TProxy policy-routing table. - ''; - example = 17; - }; - - routeTable = mkOption { - type = types.int; - default = 102; - description = '' - Policy-routing table used by the app-routing TProxy backend. - ''; - example = 102; - }; - - localSubnets = mkOption { - type = types.listOf types.str; - default = [ "192.168.0.0/16" ]; - description = '' - Destination subnets that should bypass app-routing TProxy - interception, except DNS traffic on port 53. - ''; - example = [ - "192.168.0.0/16" - "10.0.0.0/8" - ]; - }; - }; - - zapret = { - enable = mkEnableOption "app-scoped zapret backend for appRouting profiles"; - - filterMark = mkOption { - type = types.int; - default = 268435456; - description = '' - Packet mark bit used to mark wrapped app traffic for the - dedicated app-scoped zapret instance. - ''; - example = 268435456; - }; - - qnum = mkOption { - type = types.int; - default = 201; - description = '' - NFQUEUE number used by the dedicated app-scoped zapret instance. - This backend runs as a second zapret daemon and should use a - queue distinct from the global zapret instance. - ''; - example = 201; - }; - }; - }; - - }; - - zapret = { - enable = mkEnableOption "zapret DPI bypass"; - - syncDirectRouting = mkOption { - type = types.bool; - default = true; - description = '' - When zapret.enable = true, mirror zapret's upstream domain hostlists - into sing-box direct domain routing. - - This includes the default zapret domain lists and any custom - hostlistRules entries with enableDirectSync = true. - ''; - example = true; - }; - - syncDirectRoutingUpstreamIps = mkOption { - type = types.bool; - default = false; - description = '' - When zapret.enable = true, mirror zapret's upstream ipset ranges - (such as ipset-all.txt minus exclusions) into sing-box direct IP routing. - ''; - example = false; - }; - - syncDirectRoutingUserIps = mkOption { - type = types.bool; - default = true; - description = '' - When zapret.enable = true, mirror user-defined zapret.ipsetAll and - zapret.ipsetExclude entries into sing-box direct IP routing. - ''; - example = true; - }; - - configName = mkOption { - type = types.str; - default = "general(ALT)"; - description = "zapret strategy preset name passed through to the generated zapret configuration."; - example = "general(ALT)"; - }; - - gameFilter = mkOption { - type = types.str; - default = "null"; - description = ''zapret game traffic filter mode: "all", "tcp", "udp", or "null" to disable.''; - example = "null"; - }; - - listGeneral = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Extra domains to include in zapret's interception list. - When syncDirectRouting = true, these domains are also mirrored into - sing-box direct routing. - ''; - example = [ "youtube.com" ]; - }; - - listExclude = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Domains to exclude from zapret interception. - When syncDirectRouting = true, these exclusions also remove matching - domains from the zapret-derived sing-box direct-routing set. - ''; - example = [ "music.youtube.com" ]; - }; - - ipsetAll = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Extra IPs/CIDRs to add to zapret's ipset. - Mirrored into sing-box direct IP routing when - syncDirectRoutingUserIps = true. - ''; - example = [ "203.0.113.0/24" ]; - }; - - ipsetExclude = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - IPs/CIDRs to exclude from zapret's ipset. - Also excluded from zapret-derived sing-box direct IP routing when - syncDirectRoutingUserIps = true. - ''; - example = [ "203.0.113.10/32" ]; - }; - - includeExtraUpstreamLists = mkOption { - type = types.bool; - default = false; - description = '' - Automatically activate upstream list-instagram.txt, list-soundcloud.txt, - and list-twitter.txt in the generated zapret config when the selected - upstream preset does not already reference them. - - When syncDirectRouting = true, domains from these extra lists are also - mirrored into sing-box direct routing. - ''; - example = false; - }; - - hostlistRules = mkOption { - type = types.listOf zapretHostlistRuleType; - default = [ ]; - description = '' - Additional named zapret hostlists with per-list DPI mitigation rules. - Each entry generates hostlists/list-.txt and can clone a built-in - zapret family, add custom NFQWS rule fragments, or both. - - Each entry must define at least one domain and at least one of preset - or nfqwsArgs. - ''; - example = [ - { - name = "googlevideo"; - domains = [ - "googlevideo.com" - "ggpht.com" - ]; - preset = "google"; - } - { - name = "example"; - domains = [ - "example.com" - "example.de" - ]; - preset = "general"; - nfqwsArgs = [ - "--filter-tcp=443 --dpi-desync=fake,multisplit" - ]; - } - ]; - }; - - cidrExemption = { - enable = mkEnableOption "CIDR exemption from zapret NFQUEUE"; - - cidrs = mkOption { - type = types.listOf types.str; - default = [ ]; - example = [ - "192.168.123.0/24" - "10.0.0.0/8" - ]; - description = '' - Subnets to exempt from zapret's NFQUEUE mangle rules. - Useful when a VM (libvirt, etc.) is behind NAT and zapret - would corrupt its traffic through the host's nftables. - ''; - }; - }; - }; - - tray = { - enable = mkEnableOption "system tray indicator for proxy-suite"; - - pollInterval = mkOption { - type = types.int; - default = 5; - description = '' - Tray status refresh interval in seconds. - Lower values make UI state changes appear faster, while higher values - reduce background polling overhead. - ''; - example = 5; - }; - - autostart = mkOption { - type = types.bool; - default = true; - description = '' - Whether to install an XDG autostart entry for the tray application - for graphical users. - ''; - example = true; - }; - }; - - tgWsProxy = { - enable = mkEnableOption "Telegram MTProto WebSocket proxy"; - - port = mkOption { - type = types.port; - default = 1076; - description = '' - TCP listen port for tg-ws-proxy. - Telegram clients connect to this endpoint when using the local MTProto - WebSocket proxy. - ''; - example = 1076; - }; - - host = mkOption { - type = types.str; - default = "127.0.0.1"; - description = '' - Bind address for tg-ws-proxy. - Keep `127.0.0.1` for local-only usage; bind to `0.0.0.0` only when you - intentionally expose the proxy to other hosts. - ''; - example = "127.0.0.1"; - }; - - secret = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - MTProto proxy secret (hex string). Legacy inline form; this value ends up - in the Nix store. Prefer secretFile for real deployments. - - Set exactly one of secret or secretFile when tgWsProxy.enable = true. - Generate one with: openssl rand -hex 16 - ''; - example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - }; - - secretFile = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Runtime path to a file containing the MTProto proxy secret. - Intended for use with secret managers so the secret stays out of the Nix store. - - Set exactly one of secretFile or secret when tgWsProxy.enable = true. - ''; - example = "/run/secrets/tg-ws-proxy-secret"; - }; - - dcIps = mkOption { - type = types.attrsOf types.str; - default = { }; - description = '' - Mapping of Telegram DC IDs to relay IPs. - Keys are DC IDs as strings and values are IPv4/IPv6 addresses used by - tg-ws-proxy for MTProto relay selection. - ''; - example = { - "2" = "149.154.167.220"; - "4" = "149.154.167.220"; - "203" = "149.154.167.220"; - }; - }; - }; - }; -} diff --git a/modules/proxy-suite/options/app-routing.nix b/modules/proxy-suite/options/app-routing.nix new file mode 100644 index 0000000..0fded13 --- /dev/null +++ b/modules/proxy-suite/options/app-routing.nix @@ -0,0 +1,231 @@ +# Per-app routing options (backends and profiles). +{ lib, ... }: + +let + inherit (lib) mkOption mkEnableOption types; + t = import ./types.nix { inherit lib; }; +in +{ + options.services.proxy-suite.appRouting = { + enable = mkEnableOption "per-app routing helpers via proxy-ctl wrap"; + + createDefaultProfiles = mkOption { + type = types.bool; + default = false; + description = '' + Whether to automatically add curated appRouting profiles. + + This is opt-in. Generated defaults are appended only when no + user-defined profile with the same name already exists. + + Current curated defaults: + - `proxychains`: route = "proxychains" + - `tun`: route = "tun" when appRouting.backends.tun.enable = true + - `tproxy`: route = "tproxy" when appRouting.backends.tproxy.enable = true + - `zapret`: route = "zapret" when appRouting.backends.zapret.enable = true + and zapret.enable = true + + This makes `proxy-ctl wrap proxychains -- ` available + without defining the profile manually, and similarly exposes + `proxy-ctl wrap tun -- ` or + `proxy-ctl wrap tproxy -- ` or + `proxy-ctl wrap zapret -- ` when the corresponding backend + is enabled. + ''; + example = true; + }; + + profiles = mkOption { + type = types.listOf t.appRoutingProfileType; + default = [ ]; + description = '' + Named per-app route profiles consumed by `proxy-ctl wrap`. + + This initial implementation supports: + - "direct" for running a command unchanged + - "proxychains" for TCP apps that can use an LD_PRELOAD wrapper + instead of global TUN or TProxy interception + - "tun" for app-scoped policy routing into the dedicated app TUN + backend + - "tproxy" for app-scoped transparent interception through the + dedicated app TProxy backend + - "zapret" for app-scoped zapret handling through a separate + zapret instance without changing the app's network path or exit IP + + proxychains-based wrapping depends on the local proxy-suite mixed + proxy listener provided by sing-box. The "tun" route depends on + appRouting.backends.tun.enable = true. The "tproxy" route depends on + appRouting.backends.tproxy.enable = true. The "zapret" route depends + on appRouting.backends.zapret.enable = true and zapret.enable = true. + + When createDefaultProfiles = true, curated defaults are added on top + of this list unless a user-defined profile already uses the same + name. + ''; + example = [ + { + name = "steam-browser"; + route = "proxychains"; + } + { + name = "native-direct"; + route = "direct"; + } + ]; + }; + + proxychains = { + enable = mkEnableOption "proxychains-backed appRouting profiles"; + + quiet = mkOption { + type = types.bool; + default = true; + description = '' + Whether generated proxychains wrappers should suppress their normal + startup chatter. This maps to proxychains-ng quiet_mode. + ''; + example = true; + }; + + proxyDns = mkOption { + type = types.bool; + default = true; + description = '' + Whether generated proxychains wrappers should resolve DNS through + the proxy instead of the local resolver. This maps to proxychains-ng + proxy_dns. + ''; + example = true; + }; + }; + + backends = { + tun = { + enable = mkEnableOption "app-scoped TUN backend for appRouting profiles"; + + interface = mkOption { + type = types.str; + default = "psapptun0"; + description = '' + Name of the dedicated app-routing TUN interface used by + proxy-suite-app-tun. + ''; + example = "psapptun0"; + }; + + address = mkOption { + type = types.str; + default = "172.20.0.1/30"; + description = '' + Address assigned to the app-routing TUN interface in CIDR + notation. + ''; + example = "172.20.0.1/30"; + }; + + mtu = mkOption { + type = types.int; + default = 1400; + description = '' + MTU for the app-routing TUN interface. + ''; + example = 1400; + }; + + fwmark = mkOption { + type = types.int; + default = 16; + description = '' + Packet mark used to steer wrapped app traffic into the app-routing + TUN policy-routing table. + ''; + example = 16; + }; + + routeTable = mkOption { + type = types.int; + default = 101; + description = '' + Policy-routing table used by the app-routing TUN backend. + ''; + example = 101; + }; + + localSubnets = mkOption { + type = types.listOf types.str; + default = [ "192.168.0.0/16" ]; + description = '' + Destination subnets that should bypass the app-routing TUN mark, + so wrapped apps can still reach local LAN resources directly. + ''; + example = [ + "192.168.0.0/16" + "10.0.0.0/8" + ]; + }; + }; + + tproxy = { + enable = mkEnableOption "app-scoped TProxy backend for appRouting profiles"; + + fwmark = mkOption { + type = types.int; + default = 17; + description = '' + Packet mark used to steer wrapped app traffic into the app-routing + TProxy policy-routing table. + ''; + example = 17; + }; + + routeTable = mkOption { + type = types.int; + default = 102; + description = '' + Policy-routing table used by the app-routing TProxy backend. + ''; + example = 102; + }; + + localSubnets = mkOption { + type = types.listOf types.str; + default = [ "192.168.0.0/16" ]; + description = '' + Destination subnets that should bypass app-routing TProxy + interception, except DNS traffic on port 53. + ''; + example = [ + "192.168.0.0/16" + "10.0.0.0/8" + ]; + }; + }; + + zapret = { + enable = mkEnableOption "app-scoped zapret backend for appRouting profiles"; + + filterMark = mkOption { + type = types.int; + default = 268435456; + description = '' + Packet mark bit used to mark wrapped app traffic for the + dedicated app-scoped zapret instance. + ''; + example = 268435456; + }; + + qnum = mkOption { + type = types.int; + default = 201; + description = '' + NFQUEUE number used by the dedicated app-scoped zapret instance. + This backend runs as a second zapret daemon and should use a + queue distinct from the global zapret instance. + ''; + example = 201; + }; + }; + }; + + }; +} diff --git a/modules/proxy-suite/options/default.nix b/modules/proxy-suite/options/default.nix new file mode 100644 index 0000000..9d0c54a --- /dev/null +++ b/modules/proxy-suite/options/default.nix @@ -0,0 +1,10 @@ +# All option declarations for services.proxy-suite, split by feature area. +{ ... }: +{ + imports = [ + ./other.nix + ./sing-box.nix + ./app-routing.nix + ./zapret.nix + ]; +} diff --git a/modules/proxy-suite/options/other.nix b/modules/proxy-suite/options/other.nix new file mode 100644 index 0000000..553ff66 --- /dev/null +++ b/modules/proxy-suite/options/other.nix @@ -0,0 +1,139 @@ +# Top-level, userControl, tray, and tgWsProxy options. +{ lib, ... }: + +let + inherit (lib) mkOption mkEnableOption types; +in +{ + options.services.proxy-suite = { + enable = mkEnableOption "proxy suite (sing-box + zapret + tg-ws-proxy)"; + + userControl = { + group = mkOption { + type = types.strMatching "^[a-z_][a-z0-9_-]*$"; + default = "proxy-suite"; + description = '' + Local group allowed to use passwordless polkit-backed `proxy-ctl` + commands when userControl.global.enable or userControl.perApp.enable + is turned on. + ''; + example = "proxy-suite"; + }; + + global.enable = + (mkEnableOption "passwordless proxy-ctl control over global proxy-suite units") + // { + default = true; + description = '' + Whether members of userControl.group may manage global + proxy-suite units without password prompts via commands like + `proxy-ctl tun on|off`, `proxy-ctl tproxy on|off`, + `proxy-ctl restart`, or `proxy-ctl subscription update`. + ''; + }; + + perApp.enable = + (mkEnableOption "passwordless proxy-ctl control over per-app routing helpers") + // { + default = true; + description = '' + Whether members of userControl.group may start and stop the + app-scoped backend units used by `proxy-ctl wrap ...` for + route = "tun", route = "tproxy", or route = "zapret" profiles + without password prompts. + ''; + }; + }; + + tray = { + enable = mkEnableOption "system tray indicator for proxy-suite"; + + pollInterval = mkOption { + type = types.int; + default = 5; + description = '' + Tray status refresh interval in seconds. + Lower values make UI state changes appear faster, while higher values + reduce background polling overhead. + ''; + example = 5; + }; + + autostart = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install an XDG autostart entry for the tray application + for graphical users. + ''; + example = true; + }; + }; + + tgWsProxy = { + enable = mkEnableOption "Telegram MTProto WebSocket proxy"; + + port = mkOption { + type = types.port; + default = 1076; + description = '' + TCP listen port for tg-ws-proxy. + Telegram clients connect to this endpoint when using the local MTProto + WebSocket proxy. + ''; + example = 1076; + }; + + host = mkOption { + type = types.str; + default = "127.0.0.1"; + description = '' + Bind address for tg-ws-proxy. + Keep `127.0.0.1` for local-only usage; bind to `0.0.0.0` only when you + intentionally expose the proxy to other hosts. + ''; + example = "127.0.0.1"; + }; + + secret = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + MTProto proxy secret (hex string). Legacy inline form; this value ends up + in the Nix store. Prefer secretFile for real deployments. + + Set exactly one of secret or secretFile when tgWsProxy.enable = true. + Generate one with: openssl rand -hex 16 + ''; + example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + }; + + secretFile = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Runtime path to a file containing the MTProto proxy secret. + Intended for use with secret managers so the secret stays out of the Nix store. + + Set exactly one of secretFile or secret when tgWsProxy.enable = true. + ''; + example = "/run/secrets/tg-ws-proxy-secret"; + }; + + dcIps = mkOption { + type = types.attrsOf types.str; + default = { }; + description = '' + Mapping of Telegram DC IDs to relay IPs. + Keys are DC IDs as strings and values are IPv4/IPv6 addresses used by + tg-ws-proxy for MTProto relay selection. + ''; + example = { + "2" = "149.154.167.220"; + "4" = "149.154.167.220"; + "203" = "149.154.167.220"; + }; + }; + }; + }; +} diff --git a/modules/proxy-suite/options/sing-box.nix b/modules/proxy-suite/options/sing-box.nix new file mode 100644 index 0000000..fd3ec8e --- /dev/null +++ b/modules/proxy-suite/options/sing-box.nix @@ -0,0 +1,471 @@ +# sing-box proxy client options. +{ lib, ... }: + +let + inherit (lib) mkOption mkEnableOption types; + t = import ./types.nix { inherit lib; }; +in +{ + options.services.proxy-suite.singBox = { + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to configure and run sing-box services for proxy-suite. + When disabled, singBox.* options are ignored even if proxy-suite itself + is enabled. + ''; + }; + + outbounds = mkOption { + type = types.listOf t.outboundType; + default = [ ]; + description = '' + List of static proxy outbounds. + Set exactly one of urlFile, url, or json per entry. + + At least one outbound or one subscription is required when + singBox.enable = true. + ''; + example = [ + { + tag = "de-vps"; + urlFile = "/run/secrets/proxy-de-url"; + } + { + tag = "nl-vps"; + url = "hy2://password@example.com:443?sni=example.com"; + } + ]; + }; + + subscriptions = mkOption { + type = types.listOf t.subscriptionType; + default = [ ]; + description = '' + Subscription URLs that provide dynamic lists of proxy outbounds. + Each URL must return a base64-encoded newline-separated list of proxy URIs + (standard v2rayN / Clash subscription format) or plain text of the same. + + On first service start, each subscription is fetched live and cached + under /var/lib/proxy-suite/subscriptions/.json. Later restarts + reuse the cache, so ordinary service restarts do not need network access. + + A systemd timer (proxy-suite-subscription-update) refreshes all caches on + the interval set by subscriptionUpdateInterval and restarts the running + sing-box services after a successful refresh. + ''; + example = [ + { + tag = "community"; + url = "https://example.com/sub/token"; + } + { + tag = "private"; + urlFile = "/run/secrets/private-sub-url"; + } + ]; + }; + + subscriptionUpdateInterval = mkOption { + type = types.str; + default = "1d"; + description = '' + How often the proxy-suite-subscription-update timer fires and refreshes + all subscription caches. Accepts any systemd time span string + (e.g. "1h", "6h", "1d", "12h"). + + Only used when singBox.subscriptions is non-empty. The timer also runs + once shortly after boot. + ''; + example = "6h"; + }; + + selection = mkOption { + type = types.enum [ + "first" + "selector" + "urltest" + ]; + default = "first"; + description = '' + How to pick between multiple proxy outbounds: + + - "first": route through a single active outbound tagged "proxy". + The first static outbound is used, or the first subscription + outbound if only subscriptions are configured. + - "selector": create a Clash-compatible selector outbound tagged + "proxy" and keep all configured outbounds available for manual + switching via the Clash API. + - "urltest": create an automatic latency-testing outbound tagged + "proxy" and keep all configured outbounds available so sing-box + can periodically probe and switch to a faster one. + + clashApiPort is only used with "selector" or "urltest". + urlTest.* options are only used with "urltest". + Per-outbound tags are only individually meaningful with "selector" + or "urltest". + ''; + example = "urltest"; + }; + + urlTest = { + url = mkOption { + type = types.str; + default = "https://www.gstatic.com/generate_204"; + description = '' + URL that sing-box fetches through each proxy to measure latency. + Only used when selection = "urltest". + + Set this to a URL that is actually blocked in your region (e.g. + "https://telegram.org") so that only proxies that bypass the + blocking get selected. If left at the default, any responding proxy + wins – including ones that might not unblock your target site. + ''; + example = "https://telegram.org"; + }; + + interval = mkOption { + type = types.str; + default = "3m"; + description = '' + How often sing-box re-tests all outbounds. Accepts a Go duration + string (e.g. "1m", "3m", "10m"). + Only used when selection = "urltest". + ''; + example = "1m"; + }; + + tolerance = mkOption { + type = types.int; + default = 50; + description = '' + Latency tolerance in milliseconds. The current proxy is only replaced + when a competing one is faster by more than this value. + + Only used when selection = "urltest". + ''; + example = 100; + }; + }; + + clashApiPort = mkOption { + type = types.port; + default = 9090; + description = '' + Port for the Clash-compatible REST API exposed by sing-box. + Only used when selection is "selector" or "urltest". Ignored in + "first" mode because there is no selector-style outbound to control. + ''; + example = 9090; + }; + + listenAddress = mkOption { + type = types.str; + default = "127.0.0.1"; + description = '' + Address for the SOCKS5/HTTP mixed inbound to bind to. + This affects the always-on proxy-suite-socks service. + + Use "0.0.0.0" only if you intentionally want to expose the proxy to + other machines on your network. + ''; + example = "127.0.0.1"; + }; + + port = mkOption { + type = types.port; + default = 1080; + description = '' + Listen port for the always-on SOCKS5/HTTP mixed inbound provided by + proxy-suite-socks. + ''; + example = 1080; + }; + + tproxyPort = mkOption { + type = types.port; + default = 1081; + description = '' + Local listen port for sing-box's TProxy inbound. + nftables redirection created by proxy-suite-tproxy sends intercepted + TCP/UDP traffic to this port. + ''; + example = 1081; + }; + + fwmark = mkOption { + type = types.int; + default = 1; + description = '' + Mark applied to intercepted packets in TProxy mode. + A matching `ip rule` routes this mark to singBox.routeTable, which + points traffic to loopback for local proxy processing. + ''; + example = 1; + }; + + proxyMark = mkOption { + type = types.int; + default = 2; + description = '' + Mark applied to sing-box egress packets in TProxy mode so they bypass + re-interception and do not loop back into the transparent proxy path. + ''; + example = 2; + }; + + routeTable = mkOption { + type = types.int; + default = 100; + description = '' + Policy-routing table number used for TProxy interception flow. + The module installs a local default route in this table and binds it + to singBox.fwmark. + ''; + example = 100; + }; + + proxyByDefault = mkOption { + type = types.bool; + default = true; + description = '' + Whether traffic that does not match any explicit routing rule should + go through the proxy or go direct. + + This affects sing-box route.final and dns.final in the generated + config. + ''; + example = true; + }; + + dns = { + local = mkOption { + type = t.dnsUpstreamType; + default = { + type = "udp"; + address = "1.1.1.1"; + port = 53; + }; + description = '' + DNS upstream used for the built-in "local" resolver role. + This resolver is also used as sing-box route.default_domain_resolver. + + The module keeps detour policy automatic: in mixed/TProxy mode and + app-routing TUN mode, "local" stays on the direct path (without an + explicit detour); in global TUN mode, it is forced through the proxy to avoid + auto_redirect conflicts. + ''; + example = { + type = "tcp"; + address = "9.9.9.9"; + port = 53; + }; + }; + + remote = mkOption { + type = t.dnsUpstreamType; + default = { + type = "udp"; + address = "1.1.1.1"; + port = 53; + }; + description = '' + DNS upstream used for the built-in "remote" resolver role. + + This resolver always detours through the proxy and becomes the + generated dns.final target when singBox.proxyByDefault = true. + ''; + example = { + type = "tls"; + address = "1.1.1.1"; + port = 853; + }; + }; + }; + + tun = { + enable = mkEnableOption "TUN mode service (opt-in, mutually exclusive with proxy-suite-tproxy)"; + + autostart = mkOption { + type = types.bool; + default = false; + description = '' + Whether to start proxy-suite-tun automatically during boot by + attaching it to multi-user.target. + Cannot be enabled together with singBox.tproxy.autostart. + ''; + example = true; + }; + + interface = mkOption { + type = types.str; + default = "singtun0"; + description = "Name of the TUN interface created by proxy-suite-tun."; + example = "singtun0"; + }; + + address = mkOption { + type = types.str; + default = "172.19.0.1/30"; + description = "Address assigned to the TUN interface in CIDR notation."; + example = "172.19.0.1/30"; + }; + + mtu = mkOption { + type = types.int; + default = 1400; + description = "MTU for the TUN interface created by proxy-suite-tun."; + example = 1400; + }; + }; + + tproxy = { + enable = mkEnableOption "TProxy mode service (opt-in, transparent proxy via nftables)"; + + autostart = mkOption { + type = types.bool; + default = false; + description = '' + Whether to start proxy-suite-tproxy automatically during boot by + attaching it to multi-user.target. + Cannot be enabled together with singBox.tun.autostart. + ''; + example = true; + }; + + localSubnets = mkOption { + type = types.listOf types.str; + default = [ "192.168.0.0/16" ]; + description = '' + Subnets whose traffic bypasses TProxy interception, except DNS (port 53). + + Typically this should include your LAN subnet(s). VM bridge networks + should usually go here too, or use zapret.cidrExemption for + subnet-specific NFQUEUE exemption on the zapret side. + ''; + example = [ + "192.168.0.0/16" + "10.0.0.0/8" + ]; + }; + }; + + routing = { + enableRuDirect = mkOption { + type = types.bool; + default = true; + description = '' + Automatically append "category-ru" to routing.direct.geosites and + "ru" to routing.direct.geoips. + + This is additive: user-defined routing.direct.* entries still apply. + ''; + example = true; + }; + + proxy = t.routingFields; + + direct = { + domains = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Domain suffixes to send direct (bypass proxy). + Merged with zapret-synced direct domains when zapret direct sync + options are enabled. + ''; + example = [ "internal.example" ]; + }; + ips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + IP CIDRs to send direct. + Merged with zapret-synced direct IPs when the corresponding zapret + sync options are enabled. + ''; + example = [ "10.10.0.0/16" ]; + }; + geosites = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + sing-geosite names to send direct. + "category-ru" is added automatically when enableRuDirect = true. + ''; + example = [ "category-ru" ]; + }; + geoips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + sing-geoip names to send direct. + "ru" is added automatically when enableRuDirect = true. + ''; + example = [ "ru" ]; + }; + }; + + block = { + domains = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "Domain suffixes to block entirely."; + example = [ "ads.example.com" ]; + }; + ips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "IP CIDRs to block."; + example = [ "203.0.113.0/24" ]; + }; + geosites = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "sing-geosite names to block."; + example = [ "category-ads-all" ]; + }; + geoips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "sing-geoip names to block."; + example = [ "cn" ]; + }; + }; + + # Per-outbound routing rules evaluated before global proxy/direct/block lists. + # Equivalent to setting outbound.routing.* directly on each outbound definition. + rules = mkOption { + type = types.listOf t.routingRuleType; + default = [ ]; + description = '' + Explicit routing rules evaluated before global proxy/direct/block lists. + Each rule routes matching traffic to a specific outbound tag. + + The outbound can be a configured outbound tag (useful with selector/urltest), + or one of: "proxy" (active proxy), "direct", "block". + + Order is preserved. The first matching rule wins in sing-box. + With selection = "first", non-built-in outbound tags are effectively + routed to the single active "proxy" outbound. + ''; + example = [ + { + outbound = "vps-de"; + domains = [ "netflix.com" ]; + geosites = [ "netflix" ]; + } + { + outbound = "direct"; + domains = [ "internal.corp" ]; + } + { + outbound = "block"; + domains = [ "ads.example.com" ]; + } + ]; + }; + }; + }; +} diff --git a/modules/proxy-suite/options/types.nix b/modules/proxy-suite/options/types.nix new file mode 100644 index 0000000..6606d8b --- /dev/null +++ b/modules/proxy-suite/options/types.nix @@ -0,0 +1,341 @@ +# Type submodule definitions shared across options sub-files. +{ lib }: + +let + inherit (lib) mkOption types; + + # Shared routing-rule fields (reused in both outboundType.routing and routing.rules entries) + routingFields = { + domains = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Domain suffixes to match in this routing rule. + Leave empty to skip domain-based matching for this rule entry. + ''; + example = [ + "youtube.com" + "discord.com" + ]; + }; + ips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + IP CIDRs to match in this routing rule. + Leave empty to skip IP-based matching for this rule entry. + ''; + example = [ "1.1.1.0/24" ]; + }; + geosites = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + sing-geosite rule-set names to match in this routing rule. + Each name becomes a sing-box geosite rule-set reference. + ''; + example = [ + "netflix" + "google" + ]; + }; + geoips = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + sing-geoip rule-set names to match in this routing rule. + Each name becomes a sing-box geoip rule-set reference. + ''; + example = [ + "us" + "de" + ]; + }; + }; + + # An explicit routing rule – associates traffic patterns with a named outbound. + routingRuleType = types.submodule { + options = { + outbound = mkOption { + type = types.str; + description = '' + Target outbound tag. Can be a specific server tag (only useful with + selection = "selector" or "urltest"), or one of the built-in tags: + "proxy" (the active proxy outbound), "direct", "block". + + With selection = "first", named proxy outbounds are collapsed into the + single active "proxy" outbound at runtime, so per-tag routing no longer + distinguishes between individual proxy servers. + ''; + example = "vps-de"; + }; + } + // routingFields; + }; + + subscriptionType = types.submodule { + options = { + tag = mkOption { + type = types.str; + description = '' + Unique identifier for this subscription. + Used as a prefix for all outbound tags generated from its proxy list, + e.g. "my-sub" -> tags like "my-sub-Server-DE". + ''; + example = "community-list"; + }; + + url = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Literal subscription URL. The response must be a base64-encoded + newline-separated list of proxy URIs (standard v2rayN format) or + a plain-text list of the same. + + This value is embedded in the Nix store. Prefer urlFile for private + subscription links or tokens. + ''; + example = "https://example.com/sub/token123"; + }; + + urlFile = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Runtime path to a file containing the subscription URL. + Intended for use with secret managers (sops-nix, agenix, etc.). + The file is read at service start time and never lands in the Nix store. + + Set exactly one of urlFile or url for each subscription entry. + ''; + example = "/run/secrets/proxy-subscription-url"; + }; + }; + }; + + outboundType = types.submodule { + options = { + tag = mkOption { + type = types.str; + description = '' + Outbound tag used in routing rules and multi-outbound selection. + + With selection = "selector" or "urltest", each outbound keeps its own + tag and can be selected directly. With selection = "first", sing-box + routes through a single active outbound tagged "proxy", so individual + proxy tags are mainly useful for documentation and config structure. + ''; + example = "vps-de"; + }; + + urlFile = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Runtime path to a file containing the proxy URL. + Intended for use with secret managers (sops-nix, agenix, etc.). + The file is read at service start time and never lands in the Nix store. + + Set exactly one of urlFile, url, or json for each outbound. + ''; + example = "/run/secrets/my-proxy-url"; + }; + + url = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Literal proxy URL. Convenient for non-secret configs, but the URL + will end up in the Nix store. + + Set exactly one of urlFile, url, or json for each outbound. + Prefer urlFile for real credentials. + ''; + example = "hy2://password@example.com:443?sni=example.com"; + }; + + json = mkOption { + type = types.nullOr types.attrs; + default = null; + description = '' + Raw sing-box outbound configuration as a Nix attribute set. + Embedded directly into the config at build time. The tag field + is overridden by the outbound's tag option. + + Set exactly one of urlFile, url, or json for each outbound. + Use this when the proxy definition is easier to generate as native Nix + than as a single URL string. + ''; + example = { + type = "vless"; + server = "example.com"; + server_port = 443; + uuid = "..."; + }; + }; + + # Shorthand for attaching routing rules directly to an outbound definition. + # Traffic matching these patterns is sent to this specific outbound. + # Only meaningful when selection = "selector" or "urltest" (with "first", + # all proxy traffic goes to the single "proxy" outbound anyway). + routing = routingFields; + }; + }; + + dnsUpstreamType = types.submodule { + options = { + type = mkOption { + type = types.enum [ + "udp" + "tcp" + "tls" + ]; + default = "udp"; + description = '' + sing-box DNS transport type for this upstream resolver. + ''; + example = "tls"; + }; + + address = mkOption { + type = types.strMatching ".+"; + description = '' + Resolver address or hostname used for this DNS upstream. + ''; + example = "1.1.1.1"; + }; + + port = mkOption { + type = types.port; + default = 53; + description = '' + Destination port for this DNS upstream. + ''; + example = 853; + }; + }; + }; + + zapretPresetType = types.enum [ + "general" + "google" + "instagram" + "soundcloud" + "twitter" + ]; + + zapretHostlistRuleType = types.submodule { + options = { + name = mkOption { + type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; + description = '' + Custom hostlist name. Used to generate hostlists/list-.txt + inside the derived zapret config directory. + ''; + example = "cloudflare"; + }; + + domains = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Domains written into the generated custom zapret hostlist file. + Must be non-empty for every hostlistRules entry. + ''; + example = [ + "example.com" + "example.de" + ]; + }; + + preset = mkOption { + type = types.nullOr zapretPresetType; + default = null; + description = '' + Clone the active zapret config's built-in NFQWS rule family for this + hostlist. Can be combined with nfqwsArgs for additional custom rules. + ''; + example = "google"; + }; + + nfqwsArgs = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Additional NFQWS argument fragments for this hostlist. + The module injects --hostlist=... and trailing --new automatically. + + Each hostlistRules entry must define preset, nfqwsArgs, or both. + ''; + example = [ + "--filter-tcp=443 --dpi-desync=fake,multisplit" + ]; + }; + + enableDirectSync = mkOption { + type = types.bool; + default = true; + description = '' + Whether this custom hostlist should also be mirrored into sing-box + direct domain routing when zapret.syncDirectRouting = true. + ''; + }; + }; + }; + + appRoutingProfileType = types.submodule { + options = { + name = mkOption { + type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; + description = '' + Profile name used by `proxy-ctl wrap -- `. + Must be unique within appRouting.profiles. + ''; + example = "steam-browser"; + }; + + route = mkOption { + type = types.enum [ + "direct" + "proxychains" + "tun" + "tproxy" + "zapret" + ]; + default = "proxychains"; + description = '' + Per-app route backend used by proxy-ctl wrap. + + - "direct": run the command unchanged. + - "proxychains": run the command through proxychains-ng using the + local proxy-suite mixed SOCKS endpoint. + - "tun": launch the command in the dedicated app-routing TUN slice so + only that app's traffic is policy-routed into the app TUN backend. + - "tproxy": launch the command in the dedicated app-routing TProxy + slice so only that app's traffic is transparently intercepted by + the local sing-box TProxy inbound. + - "zapret": launch the command in the dedicated app-routing zapret + slice so only that app's traffic is handled by the separate + app-scoped zapret instance. + + Additional route backends may be added in the future. + ''; + example = "proxychains"; + }; + }; + }; + +in +{ + inherit + routingFields + routingRuleType + subscriptionType + outboundType + dnsUpstreamType + zapretPresetType + zapretHostlistRuleType + appRoutingProfileType + ; +} diff --git a/modules/proxy-suite/options/zapret.nix b/modules/proxy-suite/options/zapret.nix new file mode 100644 index 0000000..368f095 --- /dev/null +++ b/modules/proxy-suite/options/zapret.nix @@ -0,0 +1,169 @@ +# zapret DPI bypass options. +{ lib, ... }: + +let + inherit (lib) mkOption mkEnableOption types; + t = import ./types.nix { inherit lib; }; +in +{ + options.services.proxy-suite.zapret = { + enable = mkEnableOption "zapret DPI bypass"; + + syncDirectRouting = mkOption { + type = types.bool; + default = true; + description = '' + When zapret.enable = true, mirror zapret's upstream domain hostlists + into sing-box direct domain routing. + + This includes the default zapret domain lists and any custom + hostlistRules entries with enableDirectSync = true. + ''; + example = true; + }; + + syncDirectRoutingUpstreamIps = mkOption { + type = types.bool; + default = false; + description = '' + When zapret.enable = true, mirror zapret's upstream ipset ranges + (such as ipset-all.txt minus exclusions) into sing-box direct IP routing. + ''; + example = false; + }; + + syncDirectRoutingUserIps = mkOption { + type = types.bool; + default = true; + description = '' + When zapret.enable = true, mirror user-defined zapret.ipsetAll and + zapret.ipsetExclude entries into sing-box direct IP routing. + ''; + example = true; + }; + + configName = mkOption { + type = types.str; + default = "general(ALT)"; + description = "zapret strategy preset name passed through to the generated zapret configuration."; + example = "general(ALT)"; + }; + + gameFilter = mkOption { + type = types.str; + default = "null"; + description = ''zapret game traffic filter mode: "all", "tcp", "udp", or "null" to disable.''; + example = "null"; + }; + + listGeneral = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Extra domains to include in zapret's interception list. + When syncDirectRouting = true, these domains are also mirrored into + sing-box direct routing. + ''; + example = [ "youtube.com" ]; + }; + + listExclude = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Domains to exclude from zapret interception. + When syncDirectRouting = true, these exclusions also remove matching + domains from the zapret-derived sing-box direct-routing set. + ''; + example = [ "music.youtube.com" ]; + }; + + ipsetAll = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Extra IPs/CIDRs to add to zapret's ipset. + Mirrored into sing-box direct IP routing when + syncDirectRoutingUserIps = true. + ''; + example = [ "203.0.113.0/24" ]; + }; + + ipsetExclude = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + IPs/CIDRs to exclude from zapret's ipset. + Also excluded from zapret-derived sing-box direct IP routing when + syncDirectRoutingUserIps = true. + ''; + example = [ "203.0.113.10/32" ]; + }; + + includeExtraUpstreamLists = mkOption { + type = types.bool; + default = false; + description = '' + Automatically activate upstream list-instagram.txt, list-soundcloud.txt, + and list-twitter.txt in the generated zapret config when the selected + upstream preset does not already reference them. + + When syncDirectRouting = true, domains from these extra lists are also + mirrored into sing-box direct routing. + ''; + example = false; + }; + + hostlistRules = mkOption { + type = types.listOf t.zapretHostlistRuleType; + default = [ ]; + description = '' + Additional named zapret hostlists with per-list DPI mitigation rules. + Each entry generates hostlists/list-.txt and can clone a built-in + zapret family, add custom NFQWS rule fragments, or both. + + Each entry must define at least one domain and at least one of preset + or nfqwsArgs. + ''; + example = [ + { + name = "googlevideo"; + domains = [ + "googlevideo.com" + "ggpht.com" + ]; + preset = "google"; + } + { + name = "example"; + domains = [ + "example.com" + "example.de" + ]; + preset = "general"; + nfqwsArgs = [ + "--filter-tcp=443 --dpi-desync=fake,multisplit" + ]; + } + ]; + }; + + cidrExemption = { + enable = mkEnableOption "CIDR exemption from zapret NFQUEUE"; + + cidrs = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ + "192.168.123.0/24" + "10.0.0.0/8" + ]; + description = '' + Subnets to exempt from zapret's NFQUEUE mangle rules. + Useful when a VM (libvirt, etc.) is behind NAT and zapret + would corrupt its traffic through the host's nftables. + ''; + }; + }; + }; +} diff --git a/modules/proxy-suite/rules.nix b/modules/proxy-suite/rules.nix index 9b43297..804c548 100644 --- a/modules/proxy-suite/rules.nix +++ b/modules/proxy-suite/rules.nix @@ -89,26 +89,11 @@ let geoips = lib.unique (r.direct.geoips ++ lib.optional r.enableRuDirect "ru"); }; - mkDomainRule = - tag: domains: - lib.optional (domains != [ ]) { - domain_suffix = domains; - outbound = tag; - }; - - mkIPRule = - tag: ips: - lib.optional (ips != [ ]) { - ip_cidr = ips; - outbound = tag; - }; - - mkRulesetRule = - tag: tags: - lib.optional (tags != [ ]) { - rule_set = tags; - outbound = tag; - }; + mkRule = field: tag: items: + lib.optional (items != [ ]) { ${field} = items; outbound = tag; }; + mkDomainRule = mkRule "domain_suffix"; + mkIPRule = mkRule "ip_cidr"; + mkRulesetRule = mkRule "rule_set"; # In "first" mode the start script renames the first outbound to "proxy", # so any per-outbound routing tag that isn't direct/block/proxy must map diff --git a/modules/proxy-suite/zapret.nix b/modules/proxy-suite/zapret.nix index 578203d..10535ab 100644 --- a/modules/proxy-suite/zapret.nix +++ b/modules/proxy-suite/zapret.nix @@ -156,21 +156,16 @@ let fi } - ${lib.optionalString (listGeneralFile != null) '' - append_list_file list-general-user.txt ${listGeneralFile} - ''} - - ${lib.optionalString (listExcludeFile != null) '' - append_list_file list-exclude-user.txt ${listExcludeFile} - ''} - - ${lib.optionalString (ipsetAllFile != null) '' - append_list_file ipset-all.txt ${ipsetAllFile} - ''} - - ${lib.optionalString (ipsetExcludeFile != null) '' - append_list_file ipset-exclude-user.txt ${ipsetExcludeFile} - ''} + ${lib.concatMapStrings + ({ name, file }: lib.optionalString (file != null) '' + append_list_file ${name} ${file} + '') + [ + { name = "list-general-user.txt"; file = listGeneralFile; } + { name = "list-exclude-user.txt"; file = listExcludeFile; } + { name = "ipset-all.txt"; file = ipsetAllFile; } + { name = "ipset-exclude-user.txt"; file = ipsetExcludeFile; } + ]} rm -f "$out/opt/zapret/hostlists/.game_filter.enabled" ${lib.optionalString (gameFilter != "null") '' @@ -194,24 +189,22 @@ let ${lib.optionalString forceDisableFilterMark '' set_config_var FILTER_MARK "" ''} - ${lib.optionalString (filterMark != null) '' - filter_mark_hex=$(printf '0x%x' ${toString filterMark}) - set_config_var FILTER_MARK "$filter_mark_hex" - ''} + ${lib.concatMapStrings + ({ var, value }: lib.optionalString (value != null) '' + hex=$(printf '0x%x' ${toString value}) + set_config_var ${var} "$hex" + '') + [ + { var = "FILTER_MARK"; value = filterMark; } + { var = "DESYNC_MARK"; value = desyncMark; } + { var = "DESYNC_MARK_POSTNAT"; value = desyncMarkPostnat; } + ]} ${lib.optionalString (qnum != null) '' set_config_var QNUM ${toString qnum} ''} ${lib.optionalString (modeFilter != null) '' set_config_var MODE_FILTER ${modeFilter} ''} - ${lib.optionalString (desyncMark != null) '' - desync_mark_hex=$(printf '0x%x' ${toString desyncMark}) - set_config_var DESYNC_MARK "$desync_mark_hex" - ''} - ${lib.optionalString (desyncMarkPostnat != null) '' - desync_mark_postnat_hex=$(printf '0x%x' ${toString desyncMarkPostnat}) - set_config_var DESYNC_MARK_POSTNAT "$desync_mark_postnat_hex" - ''} ${lib.optionalString (nftTable != null) '' set_config_var ZAPRET_NFT_TABLE ${nftTable} ''} @@ -255,15 +248,12 @@ let fi ''; - globalZapretEnv = [ - "ZAPRET_BASE=${globalZapretPackage}/opt/zapret" - "PATH=${lib.makeBinPath runtimeDeps}" - ]; - - appZapretEnv = [ - "ZAPRET_BASE=${appZapretPackage}/opt/zapret" + mkZapretEnv = package: [ + "ZAPRET_BASE=${package}/opt/zapret" "PATH=${lib.makeBinPath runtimeDeps}" ]; + globalZapretEnv = mkZapretEnv globalZapretPackage; + appZapretEnv = mkZapretEnv appZapretPackage; appZapretMarkUpScript = pkgs.writeShellScript "proxy-suite-app-zapret-mark-up" '' set -euo pipefail diff --git a/nix/options-doc.nix b/nix/options-doc.nix index 3123c84..e42fb40 100644 --- a/nix/options-doc.nix +++ b/nix/options-doc.nix @@ -73,7 +73,7 @@ pkgs.runCommand "proxy-suite-options.md" { } '' cat >"$preamble" <<'EOF' # proxy-suite options - This file is generated from the `services.proxy-suite` option descriptions in [`modules/proxy-suite/options.nix`](modules/proxy-suite/options.nix). + This file is generated from the `services.proxy-suite` option descriptions in [`modules/proxy-suite/options/default.nix`](/modules/proxy-suite/options/default.nix). Update module option docs there instead of editing this file by hand. ## Table of contents