extra refactoring
This commit is contained in:
14 files changed
+804
-1091
No files matched your search
@@ -103,7 +103,6 @@ services.proxy-suite = {
|
|||||||
|
|
||||||
tgWsProxy = {
|
tgWsProxy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
host = "127.0.0.1";
|
|
||||||
port = 1443;
|
port = 1443;
|
||||||
# Inline secret is convenient for testing, but ends up in the Nix store.
|
# Inline secret is convenient for testing, but ends up in the Nix store.
|
||||||
# For real use, prefer secretFile with a secret file.
|
# For real use, prefer secretFile with a secret file.
|
||||||
|
|||||||
+69
-69
@@ -983,7 +983,7 @@ Only used when selection is “selector” or “urltest”\. Ignored in
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1030,7 +1030,7 @@ submodule
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1055,7 +1055,7 @@ string matching the pattern \.+
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1088,7 +1088,7 @@ Destination port for this DNS upstream\.
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1121,7 +1121,7 @@ one of “udp”, “tcp”, “tls”
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1165,7 +1165,7 @@ submodule
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1190,7 +1190,7 @@ string matching the pattern \.+
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1223,7 +1223,7 @@ Destination port for this DNS upstream\.
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1256,7 +1256,7 @@ one of “udp”, “tcp”, “tls”
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-dns\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-dns.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1339,7 +1339,7 @@ list of (submodule)
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1383,7 +1383,7 @@ null
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1420,7 +1420,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1457,7 +1457,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1494,7 +1494,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1530,7 +1530,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1560,7 +1560,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1597,7 +1597,7 @@ null
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1634,7 +1634,7 @@ null
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1741,7 +1741,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1776,7 +1776,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1811,7 +1811,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1846,7 +1846,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1881,7 +1881,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1918,7 +1918,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1954,7 +1954,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1990,7 +1990,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2027,7 +2027,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2064,7 +2064,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2101,7 +2101,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2138,7 +2138,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2174,7 +2174,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2237,7 +2237,7 @@ list of (submodule)
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2274,7 +2274,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2311,7 +2311,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2348,7 +2348,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2384,7 +2384,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2415,7 +2415,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-routing\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-routing.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2463,7 +2463,7 @@ one of “first”, “selector”, “urltest”
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2501,7 +2501,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2553,7 +2553,7 @@ list of (submodule)
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2583,7 +2583,7 @@ string matching the pattern ^\[A-Za-z0-9]\[A-Za-z0-9\._-]\*$
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2621,7 +2621,7 @@ null
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2658,7 +2658,7 @@ null
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2691,7 +2691,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2726,7 +2726,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2762,7 +2762,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2805,7 +2805,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2838,7 +2838,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2872,7 +2872,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2911,7 +2911,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2944,7 +2944,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2979,7 +2979,7 @@ TCP/UDP traffic to this port\.
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3014,7 +3014,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3049,7 +3049,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tproxy\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tproxy.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3082,7 +3082,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3115,7 +3115,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3150,7 +3150,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3183,7 +3183,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3216,7 +3216,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3249,7 +3249,7 @@ true
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3283,7 +3283,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3317,7 +3317,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3351,7 +3351,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3390,7 +3390,7 @@ list of string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3423,7 +3423,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3456,7 +3456,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-tun\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-tun.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3491,7 +3491,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3527,7 +3527,7 @@ signed integer
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3566,7 +3566,7 @@ string
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Declared by:*
|
*Declared by:*
|
||||||
- [modules/proxy-suite/options/sing-box\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box.nix)
|
- [modules/proxy-suite/options/sing-box-outbounds\.nix](https://github.com/FUFSoB/proxy-suite-flake/blob/main/modules/proxy-suite/options/sing-box-outbounds.nix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./other.nix
|
./other.nix
|
||||||
./sing-box.nix
|
./sing-box.nix
|
||||||
|
./sing-box-outbounds.nix
|
||||||
|
./sing-box-dns.nix
|
||||||
|
./sing-box-tun.nix
|
||||||
|
./sing-box-tproxy.nix
|
||||||
|
./sing-box-routing.nix
|
||||||
./per-app-routing.nix
|
./per-app-routing.nix
|
||||||
./zapret.nix
|
./zapret.nix
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption;
|
||||||
|
t = import ./types.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.singBox.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
|
||||||
|
per-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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption types;
|
||||||
|
t = import ./types.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.singBox = {
|
||||||
|
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/<tag>.json. Later restarts
|
||||||
|
reuse the cache, so ordinary service restarts do not need network access.
|
||||||
|
|
||||||
|
A systemd timer (proxy-suite-subscription-update) refreshes all caches on
|
||||||
|
the interval set by subscriptionUpdateInterval and restarts the running
|
||||||
|
sing-box services after a successful refresh.
|
||||||
|
'';
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption types;
|
||||||
|
t = import ./types.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.singBox.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" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption mkEnableOption types;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.singBox.tproxy = {
|
||||||
|
enable = mkEnableOption "global sing-box TProxy mode service";
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
port = 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 global TProxy mode.
|
||||||
|
A matching `ip rule` routes this mark to
|
||||||
|
singBox.tproxy.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 global 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 global TProxy interception flow.
|
||||||
|
The module installs a local default route in this table and binds it
|
||||||
|
to singBox.tproxy.fwmark.
|
||||||
|
'';
|
||||||
|
example = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
localSubnets = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "192.168.0.0/16" ];
|
||||||
|
description = ''
|
||||||
|
Subnets whose traffic bypasses global 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"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
perApp = {
|
||||||
|
enable = mkEnableOption "per-app-scoped sing-box TProxy backend for perAppRouting profiles";
|
||||||
|
|
||||||
|
fwmark = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 17;
|
||||||
|
description = ''
|
||||||
|
Packet mark used to steer wrapped app traffic into the per-app-scoped
|
||||||
|
TProxy policy-routing table.
|
||||||
|
'';
|
||||||
|
example = 17;
|
||||||
|
};
|
||||||
|
|
||||||
|
routeTable = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 102;
|
||||||
|
description = ''
|
||||||
|
Policy-routing table used by the per-app-scoped TProxy backend.
|
||||||
|
'';
|
||||||
|
example = 102;
|
||||||
|
};
|
||||||
|
|
||||||
|
localSubnets = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "192.168.0.0/16" ];
|
||||||
|
description = ''
|
||||||
|
Subnets whose traffic bypasses per-app-scoped TProxy interception,
|
||||||
|
except DNS (port 53).
|
||||||
|
'';
|
||||||
|
example = [
|
||||||
|
"192.168.0.0/16"
|
||||||
|
"10.0.0.0/8"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption mkEnableOption types;
|
||||||
|
|
||||||
|
mkTunCommonFields =
|
||||||
|
{
|
||||||
|
interfaceDefault,
|
||||||
|
interfaceDescription,
|
||||||
|
addressDefault,
|
||||||
|
addressDescription,
|
||||||
|
mtuDefault,
|
||||||
|
mtuDescription,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
interface = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = interfaceDefault;
|
||||||
|
description = interfaceDescription;
|
||||||
|
example = interfaceDefault;
|
||||||
|
};
|
||||||
|
|
||||||
|
address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = addressDefault;
|
||||||
|
description = addressDescription;
|
||||||
|
example = addressDefault;
|
||||||
|
};
|
||||||
|
|
||||||
|
mtu = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = mtuDefault;
|
||||||
|
description = mtuDescription;
|
||||||
|
example = mtuDefault;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.singBox.tun = {
|
||||||
|
enable = mkEnableOption "global sing-box TUN mode service";
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
perApp = {
|
||||||
|
enable = mkEnableOption "per-app-scoped sing-box TUN backend for perAppRouting profiles";
|
||||||
|
|
||||||
|
fwmark = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 16;
|
||||||
|
description = ''
|
||||||
|
Packet mark used to steer wrapped app traffic into the per-app-scoped
|
||||||
|
TUN policy-routing table.
|
||||||
|
'';
|
||||||
|
example = 16;
|
||||||
|
};
|
||||||
|
|
||||||
|
routeTable = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 101;
|
||||||
|
description = ''
|
||||||
|
Policy-routing table used by the per-app-scoped TUN backend.
|
||||||
|
'';
|
||||||
|
example = 101;
|
||||||
|
};
|
||||||
|
|
||||||
|
localSubnets = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "192.168.0.0/16" ];
|
||||||
|
description = ''
|
||||||
|
Destination subnets that should bypass the per-app-scoped TUN mark,
|
||||||
|
so wrapped apps can still reach local LAN resources directly.
|
||||||
|
'';
|
||||||
|
example = [
|
||||||
|
"192.168.0.0/16"
|
||||||
|
"10.0.0.0/8"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// mkTunCommonFields {
|
||||||
|
interfaceDefault = "psperapptun0";
|
||||||
|
interfaceDescription = ''
|
||||||
|
Name of the dedicated per-app-routing TUN interface used by
|
||||||
|
proxy-suite-per-app-tun.
|
||||||
|
'';
|
||||||
|
addressDefault = "172.20.0.1/30";
|
||||||
|
addressDescription = ''
|
||||||
|
Address assigned to the dedicated per-app-routing TUN interface in CIDR
|
||||||
|
notation.
|
||||||
|
'';
|
||||||
|
mtuDefault = 1400;
|
||||||
|
mtuDescription = "MTU for the dedicated per-app-routing TUN interface.";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// mkTunCommonFields {
|
||||||
|
interfaceDefault = "singtun0";
|
||||||
|
interfaceDescription = "Name of the TUN interface created by proxy-suite-tun.";
|
||||||
|
addressDefault = "172.19.0.1/30";
|
||||||
|
addressDescription = "Address assigned to the global TUN interface in CIDR notation.";
|
||||||
|
mtuDefault = 1400;
|
||||||
|
mtuDescription = "MTU for the global TUN interface created by proxy-suite-tun.";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,41 +1,8 @@
|
|||||||
# sing-box proxy client options.
|
# Core sing-box options. Feature-area options live in sing-box-{outbounds,dns,tun,tproxy,routing}.nix.
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption mkEnableOption types;
|
inherit (lib) mkOption mkEnableOption types;
|
||||||
t = import ./types.nix { inherit lib; };
|
|
||||||
|
|
||||||
mkTunCommonFields =
|
|
||||||
{
|
|
||||||
interfaceDefault,
|
|
||||||
interfaceDescription,
|
|
||||||
addressDefault,
|
|
||||||
addressDescription,
|
|
||||||
mtuDefault,
|
|
||||||
mtuDescription,
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
interface = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = interfaceDefault;
|
|
||||||
description = interfaceDescription;
|
|
||||||
example = interfaceDefault;
|
|
||||||
};
|
|
||||||
|
|
||||||
address = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = addressDefault;
|
|
||||||
description = addressDescription;
|
|
||||||
example = addressDefault;
|
|
||||||
};
|
|
||||||
|
|
||||||
mtu = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = mtuDefault;
|
|
||||||
description = mtuDescription;
|
|
||||||
example = mtuDefault;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.proxy-suite.singBox = {
|
options.services.proxy-suite.singBox = {
|
||||||
@@ -49,149 +16,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
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/<tag>.json. Later restarts
|
|
||||||
reuse the cache, so ordinary service restarts do not need network access.
|
|
||||||
|
|
||||||
A systemd timer (proxy-suite-subscription-update) refreshes all caches on
|
|
||||||
the interval set by subscriptionUpdateInterval and restarts the running
|
|
||||||
sing-box services after a successful refresh.
|
|
||||||
'';
|
|
||||||
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 {
|
listenAddress = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "127.0.0.1";
|
default = "127.0.0.1";
|
||||||
@@ -227,353 +51,5 @@ in
|
|||||||
'';
|
'';
|
||||||
example = true;
|
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
|
|
||||||
per-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 "global sing-box TUN mode service";
|
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
perApp = {
|
|
||||||
enable = mkEnableOption "per-app-scoped sing-box TUN backend for perAppRouting profiles";
|
|
||||||
|
|
||||||
fwmark = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 16;
|
|
||||||
description = ''
|
|
||||||
Packet mark used to steer wrapped app traffic into the per-app-scoped
|
|
||||||
TUN policy-routing table.
|
|
||||||
'';
|
|
||||||
example = 16;
|
|
||||||
};
|
|
||||||
|
|
||||||
routeTable = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 101;
|
|
||||||
description = ''
|
|
||||||
Policy-routing table used by the per-app-scoped TUN backend.
|
|
||||||
'';
|
|
||||||
example = 101;
|
|
||||||
};
|
|
||||||
|
|
||||||
localSubnets = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ "192.168.0.0/16" ];
|
|
||||||
description = ''
|
|
||||||
Destination subnets that should bypass the per-app-scoped TUN mark,
|
|
||||||
so wrapped apps can still reach local LAN resources directly.
|
|
||||||
'';
|
|
||||||
example = [
|
|
||||||
"192.168.0.0/16"
|
|
||||||
"10.0.0.0/8"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mkTunCommonFields {
|
|
||||||
interfaceDefault = "psperapptun0";
|
|
||||||
interfaceDescription = ''
|
|
||||||
Name of the dedicated per-app-routing TUN interface used by
|
|
||||||
proxy-suite-per-app-tun.
|
|
||||||
'';
|
|
||||||
addressDefault = "172.20.0.1/30";
|
|
||||||
addressDescription = ''
|
|
||||||
Address assigned to the dedicated per-app-routing TUN interface in CIDR
|
|
||||||
notation.
|
|
||||||
'';
|
|
||||||
mtuDefault = 1400;
|
|
||||||
mtuDescription = "MTU for the dedicated per-app-routing TUN interface.";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mkTunCommonFields {
|
|
||||||
interfaceDefault = "singtun0";
|
|
||||||
interfaceDescription = "Name of the TUN interface created by proxy-suite-tun.";
|
|
||||||
addressDefault = "172.19.0.1/30";
|
|
||||||
addressDescription = "Address assigned to the global TUN interface in CIDR notation.";
|
|
||||||
mtuDefault = 1400;
|
|
||||||
mtuDescription = "MTU for the global TUN interface created by proxy-suite-tun.";
|
|
||||||
};
|
|
||||||
|
|
||||||
tproxy = {
|
|
||||||
enable = mkEnableOption "global sing-box TProxy mode service";
|
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
port = 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 global TProxy mode.
|
|
||||||
A matching `ip rule` routes this mark to
|
|
||||||
singBox.tproxy.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 global 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 global TProxy interception flow.
|
|
||||||
The module installs a local default route in this table and binds it
|
|
||||||
to singBox.tproxy.fwmark.
|
|
||||||
'';
|
|
||||||
example = 100;
|
|
||||||
};
|
|
||||||
|
|
||||||
localSubnets = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ "192.168.0.0/16" ];
|
|
||||||
description = ''
|
|
||||||
Subnets whose traffic bypasses global 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"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
perApp = {
|
|
||||||
enable = mkEnableOption "per-app-scoped sing-box TProxy backend for perAppRouting profiles";
|
|
||||||
|
|
||||||
fwmark = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 17;
|
|
||||||
description = ''
|
|
||||||
Packet mark used to steer wrapped app traffic into the per-app-scoped
|
|
||||||
TProxy policy-routing table.
|
|
||||||
'';
|
|
||||||
example = 17;
|
|
||||||
};
|
|
||||||
|
|
||||||
routeTable = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 102;
|
|
||||||
description = ''
|
|
||||||
Policy-routing table used by the per-app-scoped TProxy backend.
|
|
||||||
'';
|
|
||||||
example = 102;
|
|
||||||
};
|
|
||||||
|
|
||||||
localSubnets = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ "192.168.0.0/16" ];
|
|
||||||
description = ''
|
|
||||||
Subnets whose traffic bypasses per-app-scoped TProxy interception,
|
|
||||||
except DNS (port 53).
|
|
||||||
'';
|
|
||||||
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" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+149
-455
@@ -165,6 +165,23 @@ let
|
|||||||
services.proxy-suite = proxySuiteConfig;
|
services.proxy-suite = proxySuiteConfig;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
# Fixture that must fail validation; uses baseModule as the base.
|
||||||
|
mkBadFixture = modules:
|
||||||
|
forceEval ((evalProxySuite ([ baseModule ] ++ modules)).config.system.build.toplevel.drvPath);
|
||||||
|
# Same but without baseModule (for fixtures that need custom base config).
|
||||||
|
mkBadFixtureRaw = modules:
|
||||||
|
forceEval ((evalProxySuite modules).config.system.build.toplevel.drvPath);
|
||||||
|
# Extract the proxy-ctl package and derived script/profile values from a fixture.
|
||||||
|
mkProxyCtlDerived = fixture:
|
||||||
|
let
|
||||||
|
proxyCtl = packageByPattern fixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
||||||
|
wrapper = builtins.readFile "${proxyCtl}/bin/proxy-ctl";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit proxyCtl wrapper;
|
||||||
|
script = wrapper + "\n" + builtins.readFile "${proxyCtl}/bin/.proxy-ctl-wrapped";
|
||||||
|
profiles = builtins.fromJSON (builtins.readFile (shellValueByPrefix wrapper "export PER_APP_ROUTING_PROFILES_FILE="));
|
||||||
|
};
|
||||||
|
|
||||||
minimal = evalProxySuite [ baseModule ];
|
minimal = evalProxySuite [ baseModule ];
|
||||||
|
|
||||||
@@ -183,14 +200,8 @@ let
|
|||||||
(mkFixture {
|
(mkFixture {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox.outbounds = [
|
singBox.outbounds = [
|
||||||
{
|
{ tag = "dup"; url = "http://one.example.com:8080"; }
|
||||||
tag = "dup";
|
{ tag = "dup"; url = "http://two.example.com:8080"; }
|
||||||
url = "http://one.example.com:8080";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
tag = "dup";
|
|
||||||
url = "http://two.example.com:8080";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}).config.system.build.toplevel.drvPath
|
}).config.system.build.toplevel.drvPath
|
||||||
);
|
);
|
||||||
@@ -198,12 +209,7 @@ let
|
|||||||
reservedTag = forceEval (
|
reservedTag = forceEval (
|
||||||
(mkFixture {
|
(mkFixture {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox.outbounds = [
|
singBox.outbounds = [ { tag = "proxy"; url = "http://proxy.example.com:8080"; } ];
|
||||||
{
|
|
||||||
tag = "proxy";
|
|
||||||
url = "http://proxy.example.com:8080";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}).config.system.build.toplevel.drvPath
|
}).config.system.build.toplevel.drvPath
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -211,18 +217,8 @@ let
|
|||||||
(mkFixture {
|
(mkFixture {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox = {
|
singBox = {
|
||||||
outbounds = [
|
outbounds = [ { tag = "primary"; url = "http://proxy.example.com:8080"; } ];
|
||||||
{
|
routing.rules = [ { outbound = "missing"; domains = [ "example.com" ]; } ];
|
||||||
tag = "primary";
|
|
||||||
url = "http://proxy.example.com:8080";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
routing.rules = [
|
|
||||||
{
|
|
||||||
outbound = "missing";
|
|
||||||
domains = [ "example.com" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}).config.system.build.toplevel.drvPath
|
}).config.system.build.toplevel.drvPath
|
||||||
);
|
);
|
||||||
@@ -280,47 +276,22 @@ let
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
conflictingAutostartModes = forceEval (
|
conflictingAutostartModes = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.singBox = {
|
services.proxy-suite.singBox = {
|
||||||
tproxy = {
|
tproxy = { enable = true; autostart = true; };
|
||||||
enable = true;
|
tun = { enable = true; autostart = true; };
|
||||||
autostart = true;
|
|
||||||
};
|
|
||||||
tun = {
|
|
||||||
enable = true;
|
|
||||||
autostart = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
globalTunWithoutSingBox = forceEval (
|
globalTunWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
{ services.proxy-suite.singBox = { enable = false; tun.enable = true; }; }
|
||||||
baseModule
|
];
|
||||||
{
|
|
||||||
services.proxy-suite.singBox = {
|
|
||||||
enable = false;
|
|
||||||
tun.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
globalTproxyWithoutSingBox = forceEval (
|
globalTproxyWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
{ services.proxy-suite.singBox = { enable = false; tproxy.enable = true; }; }
|
||||||
baseModule
|
];
|
||||||
{
|
|
||||||
services.proxy-suite.singBox = {
|
|
||||||
enable = false;
|
|
||||||
tproxy.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
routingOrFixture = evalProxySuite [
|
routingOrFixture = evalProxySuite [
|
||||||
{
|
{
|
||||||
@@ -553,63 +524,37 @@ let
|
|||||||
zapretHostlistRules = mkRoutingRules zapretHostlistRulesFixture;
|
zapretHostlistRules = mkRoutingRules zapretHostlistRulesFixture;
|
||||||
zapretHostlistBase = mkZapretBase zapretHostlistRulesFixture;
|
zapretHostlistBase = mkZapretBase zapretHostlistRulesFixture;
|
||||||
|
|
||||||
duplicateZapretHostlistNames = forceEval (
|
duplicateZapretHostlistNames = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.zapret = {
|
services.proxy-suite.zapret = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostlistRules = [
|
hostlistRules = [
|
||||||
{
|
{ name = "dup"; domains = [ "one.example" ]; nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ]; }
|
||||||
name = "dup";
|
{ name = "dup"; domains = [ "two.example" ]; nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ]; }
|
||||||
domains = [ "one.example" ];
|
|
||||||
nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "dup";
|
|
||||||
domains = [ "two.example" ];
|
|
||||||
nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
emptyZapretHostlistDomains = forceEval (
|
emptyZapretHostlistDomains = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.zapret = {
|
services.proxy-suite.zapret = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostlistRules = [
|
hostlistRules = [
|
||||||
{
|
{ name = "empty"; domains = [ ]; nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ]; }
|
||||||
name = "empty";
|
|
||||||
domains = [ ];
|
|
||||||
nfqwsArgs = [ "--filter-tcp=443 --dpi-desync=fake" ];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
missingZapretHostlistAction = forceEval (
|
missingZapretHostlistAction = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.zapret = {
|
services.proxy-suite.zapret = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostlistRules = [
|
hostlistRules = [ { name = "missing"; domains = [ "missing.example" ]; } ];
|
||||||
{
|
|
||||||
name = "missing";
|
|
||||||
domains = [ "missing.example" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
proxyDirectFixture = evalProxySuite [
|
proxyDirectFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -697,43 +642,28 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
duplicateSubscriptionTags = forceEval (
|
duplicateSubscriptionTags = mkBadFixtureRaw [
|
||||||
(evalProxySuite [
|
|
||||||
{
|
{
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox.subscriptions = [
|
singBox.subscriptions = [
|
||||||
{
|
{ tag = "dup"; url = "https://example.com/sub/one"; }
|
||||||
tag = "dup";
|
{ tag = "dup"; url = "https://example.com/sub/two"; }
|
||||||
url = "https://example.com/sub/one";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
tag = "dup";
|
|
||||||
url = "https://example.com/sub/two";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
unsafeSubscriptionTag = forceEval (
|
unsafeSubscriptionTag = mkBadFixtureRaw [
|
||||||
(evalProxySuite [
|
|
||||||
{
|
{
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox.subscriptions = [
|
singBox.subscriptions = [ { tag = "bad/tag"; url = "https://example.com/sub/token"; } ];
|
||||||
{
|
|
||||||
tag = "bad/tag";
|
|
||||||
url = "https://example.com/sub/token";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
# selection=first with subscriptions only – start script must rename first
|
# selection=first with subscriptions only – start script must rename first
|
||||||
# subscription outbound to "proxy" so routing rules resolve at runtime.
|
# subscription outbound to "proxy" so routing rules resolve at runtime.
|
||||||
@@ -834,24 +764,13 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingProxychainsProxyCtl =
|
_perAppRoutingProxychains = mkProxyCtlDerived perAppRoutingProxychainsFixture;
|
||||||
packageByPattern perAppRoutingProxychainsFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingProxychainsProxyCtl = _perAppRoutingProxychains.proxyCtl;
|
||||||
perAppRoutingProxychainsWrapper =
|
perAppRoutingProxychainsWrapper = _perAppRoutingProxychains.wrapper;
|
||||||
builtins.readFile "${perAppRoutingProxychainsProxyCtl}/bin/proxy-ctl";
|
perAppRoutingProxychainsScript = _perAppRoutingProxychains.script;
|
||||||
perAppRoutingProxychainsScript =
|
perAppRoutingProxychainsProfiles = _perAppRoutingProxychains.profiles;
|
||||||
perAppRoutingProxychainsWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingProxychainsProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingProxychainsConfig =
|
perAppRoutingProxychainsConfig =
|
||||||
builtins.readFile (
|
builtins.readFile (shellValueByPrefix perAppRoutingProxychainsWrapper "export PROXYCHAINS_CONFIG=");
|
||||||
shellValueByPrefix perAppRoutingProxychainsWrapper "export PROXYCHAINS_CONFIG="
|
|
||||||
);
|
|
||||||
perAppRoutingProxychainsProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingProxychainsWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingDefaultProfilesFixture = evalProxySuite [
|
perAppRoutingDefaultProfilesFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -863,20 +782,11 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingDefaultProfilesProxyCtl =
|
_perAppRoutingDefaultProfiles = mkProxyCtlDerived perAppRoutingDefaultProfilesFixture;
|
||||||
packageByPattern perAppRoutingDefaultProfilesFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingDefaultProfilesProxyCtl = _perAppRoutingDefaultProfiles.proxyCtl;
|
||||||
perAppRoutingDefaultProfilesWrapper =
|
perAppRoutingDefaultProfilesWrapper = _perAppRoutingDefaultProfiles.wrapper;
|
||||||
builtins.readFile "${perAppRoutingDefaultProfilesProxyCtl}/bin/proxy-ctl";
|
perAppRoutingDefaultProfilesScript = _perAppRoutingDefaultProfiles.script;
|
||||||
perAppRoutingDefaultProfilesScript =
|
perAppRoutingDefaultProfiles = _perAppRoutingDefaultProfiles.profiles;
|
||||||
perAppRoutingDefaultProfilesWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingDefaultProfilesProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingDefaultProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingDefaultProfilesWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingNoDefaultProfilesFixture = evalProxySuite [
|
perAppRoutingNoDefaultProfilesFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -898,32 +808,15 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingNoDefaultProfilesProxyCtl =
|
_perAppRoutingNoDefaultProfiles = mkProxyCtlDerived perAppRoutingNoDefaultProfilesFixture;
|
||||||
packageByPattern perAppRoutingNoDefaultProfilesFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingNoDefaultProfilesProxyCtl = _perAppRoutingNoDefaultProfiles.proxyCtl;
|
||||||
perAppRoutingNoDefaultProfilesWrapper =
|
perAppRoutingNoDefaultProfilesWrapper = _perAppRoutingNoDefaultProfiles.wrapper;
|
||||||
builtins.readFile "${perAppRoutingNoDefaultProfilesProxyCtl}/bin/proxy-ctl";
|
perAppRoutingNoDefaultProfilesScript = _perAppRoutingNoDefaultProfiles.script;
|
||||||
perAppRoutingNoDefaultProfilesScript =
|
perAppRoutingNoDefaultProfiles = _perAppRoutingNoDefaultProfiles.profiles;
|
||||||
perAppRoutingNoDefaultProfilesWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingNoDefaultProfilesProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingNoDefaultProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingNoDefaultProfilesWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingDefaultProfilesWithoutProxychainsEnable = forceEval (
|
perAppRoutingDefaultProfilesWithoutProxychainsEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
{ services.proxy-suite.perAppRouting = { enable = true; createDefaultProfiles = true; }; }
|
||||||
baseModule
|
];
|
||||||
{
|
|
||||||
services.proxy-suite.perAppRouting = {
|
|
||||||
enable = true;
|
|
||||||
createDefaultProfiles = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunFixture = evalProxySuite [
|
perAppRoutingTunFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -937,20 +830,11 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingTunProxyCtl =
|
_perAppRoutingTun = mkProxyCtlDerived perAppRoutingTunFixture;
|
||||||
packageByPattern perAppRoutingTunFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingTunProxyCtl = _perAppRoutingTun.proxyCtl;
|
||||||
perAppRoutingTunWrapper =
|
perAppRoutingTunWrapper = _perAppRoutingTun.wrapper;
|
||||||
builtins.readFile "${perAppRoutingTunProxyCtl}/bin/proxy-ctl";
|
perAppRoutingTunScript = _perAppRoutingTun.script;
|
||||||
perAppRoutingTunScript =
|
perAppRoutingTunProfiles = _perAppRoutingTun.profiles;
|
||||||
perAppRoutingTunWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingTunProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingTunProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingTunWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
perAppRoutingTunStartScript =
|
perAppRoutingTunStartScript =
|
||||||
builtins.readFile perAppRoutingTunFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStart;
|
builtins.readFile perAppRoutingTunFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStart;
|
||||||
perAppRoutingTunConfig = mkPerAppTunConfig perAppRoutingTunFixture;
|
perAppRoutingTunConfig = mkPerAppTunConfig perAppRoutingTunFixture;
|
||||||
@@ -982,22 +866,14 @@ let
|
|||||||
perAppRoutingTunWithTproxyDirectOutbound =
|
perAppRoutingTunWithTproxyDirectOutbound =
|
||||||
builtins.head (builtins.filter (item: item.tag == "direct") perAppRoutingTunWithTproxyConfig.outbounds);
|
builtins.head (builtins.filter (item: item.tag == "direct") perAppRoutingTunWithTproxyConfig.outbounds);
|
||||||
|
|
||||||
perAppRoutingTunWithoutEnable = forceEval (
|
perAppRoutingTunWithoutEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.perAppRouting = {
|
services.proxy-suite.perAppRouting = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles = [
|
profiles = [ { name = "game"; route = "tun"; } ];
|
||||||
{
|
|
||||||
name = "game";
|
|
||||||
route = "tun";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTproxyFixture = evalProxySuite [
|
perAppRoutingTproxyFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -1011,20 +887,11 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingTproxyProxyCtl =
|
_perAppRoutingTproxy = mkProxyCtlDerived perAppRoutingTproxyFixture;
|
||||||
packageByPattern perAppRoutingTproxyFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingTproxyProxyCtl = _perAppRoutingTproxy.proxyCtl;
|
||||||
perAppRoutingTproxyWrapper =
|
perAppRoutingTproxyWrapper = _perAppRoutingTproxy.wrapper;
|
||||||
builtins.readFile "${perAppRoutingTproxyProxyCtl}/bin/proxy-ctl";
|
perAppRoutingTproxyScript = _perAppRoutingTproxy.script;
|
||||||
perAppRoutingTproxyScript =
|
perAppRoutingTproxyProfiles = _perAppRoutingTproxy.profiles;
|
||||||
perAppRoutingTproxyWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingTproxyProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingTproxyProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingTproxyWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
perAppRoutingTproxyStartScript =
|
perAppRoutingTproxyStartScript =
|
||||||
builtins.readFile perAppRoutingTproxyFixture.config.systemd.services."proxy-suite-per-app-tproxy".serviceConfig.ExecStart;
|
builtins.readFile perAppRoutingTproxyFixture.config.systemd.services."proxy-suite-per-app-tproxy".serviceConfig.ExecStart;
|
||||||
perAppRoutingTproxyUserStartExec =
|
perAppRoutingTproxyUserStartExec =
|
||||||
@@ -1032,107 +899,59 @@ let
|
|||||||
perAppRoutingTproxyUserStartScript =
|
perAppRoutingTproxyUserStartScript =
|
||||||
builtins.readFile (builtins.head (pkgs.lib.splitString " " perAppRoutingTproxyUserStartExec));
|
builtins.readFile (builtins.head (pkgs.lib.splitString " " perAppRoutingTproxyUserStartExec));
|
||||||
|
|
||||||
perAppRoutingTproxyWithoutEnable = forceEval (
|
perAppRoutingTproxyWithoutEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.perAppRouting = {
|
services.proxy-suite.perAppRouting = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles = [
|
profiles = [ { name = "browser"; route = "tproxy"; } ];
|
||||||
{
|
|
||||||
name = "browser";
|
|
||||||
route = "tproxy";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingProxychainsWithoutSingBox = forceEval (
|
perAppRoutingProxychainsWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox.enable = false;
|
singBox.enable = false;
|
||||||
perAppRouting = {
|
perAppRouting = { enable = true; proxychains.enable = true; };
|
||||||
enable = true;
|
|
||||||
proxychains.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunBackendWithoutSingBox = forceEval (
|
perAppRoutingTunBackendWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox = {
|
singBox = { enable = false; tun.perApp.enable = true; };
|
||||||
enable = false;
|
|
||||||
tun.perApp.enable = true;
|
|
||||||
};
|
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTproxyBackendWithoutSingBox = forceEval (
|
perAppRoutingTproxyBackendWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox = {
|
singBox = { enable = false; tproxy.perApp.enable = true; };
|
||||||
enable = false;
|
|
||||||
tproxy.perApp.enable = true;
|
|
||||||
};
|
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunProfileWithoutSingBox = forceEval (
|
perAppRoutingTunProfileWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox.enable = false;
|
singBox.enable = false;
|
||||||
perAppRouting = {
|
perAppRouting = { enable = true; profiles = [ { name = "game"; route = "tun"; } ]; };
|
||||||
enable = true;
|
};
|
||||||
profiles = [
|
|
||||||
{
|
|
||||||
name = "game";
|
|
||||||
route = "tun";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTproxyProfileWithoutSingBox = forceEval (
|
perAppRoutingTproxyProfileWithoutSingBox = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox.enable = false;
|
singBox.enable = false;
|
||||||
perAppRouting = {
|
perAppRouting = { enable = true; profiles = [ { name = "browser"; route = "tproxy"; } ]; };
|
||||||
enable = true;
|
};
|
||||||
profiles = [
|
|
||||||
{
|
|
||||||
name = "browser";
|
|
||||||
route = "tproxy";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingZapretFixture = evalProxySuite [
|
perAppRoutingZapretFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -1150,20 +969,11 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
perAppRoutingZapretProxyCtl =
|
_perAppRoutingZapret = mkProxyCtlDerived perAppRoutingZapretFixture;
|
||||||
packageByPattern perAppRoutingZapretFixture.config.environment.systemPackages ".*/[^/]*proxy-ctl(-[0-9.]+)?$";
|
perAppRoutingZapretProxyCtl = _perAppRoutingZapret.proxyCtl;
|
||||||
perAppRoutingZapretWrapper =
|
perAppRoutingZapretWrapper = _perAppRoutingZapret.wrapper;
|
||||||
builtins.readFile "${perAppRoutingZapretProxyCtl}/bin/proxy-ctl";
|
perAppRoutingZapretScript = _perAppRoutingZapret.script;
|
||||||
perAppRoutingZapretScript =
|
perAppRoutingZapretProfiles = _perAppRoutingZapret.profiles;
|
||||||
perAppRoutingZapretWrapper
|
|
||||||
+ "\n"
|
|
||||||
+ builtins.readFile "${perAppRoutingZapretProxyCtl}/bin/.proxy-ctl-wrapped";
|
|
||||||
perAppRoutingZapretProfiles =
|
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
|
||||||
shellValueByPrefix perAppRoutingZapretWrapper "export PER_APP_ROUTING_PROFILES_FILE="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
perAppRoutingZapretStartScript =
|
perAppRoutingZapretStartScript =
|
||||||
readExecScripts perAppRoutingZapretFixture.config.systemd.services."proxy-suite-per-app-zapret".serviceConfig.ExecStartPre;
|
readExecScripts perAppRoutingZapretFixture.config.systemd.services."proxy-suite-per-app-zapret".serviceConfig.ExecStartPre;
|
||||||
perAppRoutingZapretUserStartExec =
|
perAppRoutingZapretUserStartExec =
|
||||||
@@ -1217,250 +1027,134 @@ let
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
perAppRoutingZapretWithoutEnable = forceEval (
|
perAppRoutingZapretWithoutEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
zapret.enable = true;
|
zapret.enable = true;
|
||||||
perAppRouting = {
|
perAppRouting = { enable = true; profiles = [ { name = "yt"; route = "zapret"; } ]; };
|
||||||
enable = true;
|
};
|
||||||
profiles = [
|
|
||||||
{
|
|
||||||
name = "yt";
|
|
||||||
route = "zapret";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingZapretWithoutZapretService = forceEval (
|
perAppRoutingZapretWithoutZapretService = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
zapret = {
|
zapret = { enable = false; perApp.enable = true; };
|
||||||
enable = false;
|
|
||||||
perApp.enable = true;
|
|
||||||
};
|
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
duplicatePerAppRoutingProfiles = forceEval (
|
duplicatePerAppRoutingProfiles = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.perAppRouting = {
|
services.proxy-suite.perAppRouting = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles = [
|
profiles = [ { name = "dup"; } { name = "dup"; } ];
|
||||||
{ name = "dup"; }
|
|
||||||
{ name = "dup"; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingProfilesWithoutEnable = forceEval (
|
perAppRoutingProfilesWithoutEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
{ services.proxy-suite.perAppRouting.profiles = [ { name = "oops"; } ]; }
|
||||||
baseModule
|
];
|
||||||
{
|
|
||||||
services.proxy-suite.perAppRouting.profiles = [ { name = "oops"; } ];
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingProxychainsWithoutEnable = forceEval (
|
perAppRoutingProxychainsWithoutEnable = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite.perAppRouting = {
|
services.proxy-suite.perAppRouting = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles = [
|
profiles = [ { name = "steam-browser"; route = "proxychains"; } ];
|
||||||
{
|
};
|
||||||
name = "steam-browser";
|
|
||||||
route = "proxychains";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunFwmarkCollision = forceEval (
|
perAppRoutingTunFwmarkCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox = {
|
singBox = {
|
||||||
tproxy = {
|
tproxy = { enable = true; proxyMark = 16; };
|
||||||
enable = true;
|
tun.perApp = { enable = true; fwmark = 16; };
|
||||||
proxyMark = 16;
|
|
||||||
};
|
|
||||||
tun.perApp = {
|
|
||||||
enable = true;
|
|
||||||
fwmark = 16;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTproxyFwmarkCollision = forceEval (
|
perAppRoutingTproxyFwmarkCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox.tproxy = {
|
singBox.tproxy = { proxyMark = 17; perApp = { enable = true; fwmark = 17; }; };
|
||||||
proxyMark = 17;
|
|
||||||
perApp = {
|
|
||||||
enable = true;
|
|
||||||
fwmark = 17;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunTproxyFwmarkCollision = forceEval (
|
perAppRoutingTunTproxyFwmarkCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox = {
|
singBox = {
|
||||||
tun.perApp = {
|
tun.perApp = { enable = true; fwmark = 23; };
|
||||||
enable = true;
|
tproxy.perApp = { enable = true; fwmark = 23; };
|
||||||
fwmark = 23;
|
|
||||||
};
|
|
||||||
tproxy.perApp = {
|
|
||||||
enable = true;
|
|
||||||
fwmark = 23;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTunTproxyRouteTableCollision = forceEval (
|
perAppRoutingTunTproxyRouteTableCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
singBox = {
|
singBox = {
|
||||||
tun.perApp = {
|
tun.perApp = { enable = true; routeTable = 123; };
|
||||||
enable = true;
|
tproxy.perApp = { enable = true; routeTable = 123; };
|
||||||
routeTable = 123;
|
|
||||||
};
|
|
||||||
tproxy.perApp = {
|
|
||||||
enable = true;
|
|
||||||
routeTable = 123;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingZapretFilterMarkCollision = forceEval (
|
perAppRoutingZapretFilterMarkCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
zapret = {
|
zapret = { enable = true; perApp = { enable = true; filterMark = 268435456; }; };
|
||||||
enable = true;
|
|
||||||
perApp = {
|
|
||||||
enable = true;
|
|
||||||
filterMark = 268435456;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
singBox.tproxy.proxyMark = 268435456;
|
singBox.tproxy.proxyMark = 268435456;
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
perAppRoutingTproxyZapretMarkCollision = forceEval (
|
perAppRoutingTproxyZapretMarkCollision = mkBadFixture [
|
||||||
(evalProxySuite [
|
|
||||||
baseModule
|
|
||||||
{
|
{
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
zapret = {
|
zapret = { enable = true; perApp = { enable = true; filterMark = 23; }; };
|
||||||
enable = true;
|
singBox.tproxy.perApp = { enable = true; fwmark = 23; };
|
||||||
perApp = {
|
|
||||||
enable = true;
|
|
||||||
filterMark = 23;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
singBox.tproxy.perApp = {
|
|
||||||
enable = true;
|
|
||||||
fwmark = 23;
|
|
||||||
};
|
|
||||||
perAppRouting.enable = true;
|
perAppRouting.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
# Validation failures
|
# Validation failures
|
||||||
subscriptionBothSources = forceEval (
|
subscriptionBothSources = mkBadFixtureRaw [
|
||||||
(evalProxySuite [
|
|
||||||
{
|
{
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
services.proxy-suite = {
|
services.proxy-suite = {
|
||||||
enable = true;
|
enable = true;
|
||||||
singBox.subscriptions = [
|
singBox.subscriptions = [
|
||||||
{
|
{ tag = "bad"; url = "https://example.com/sub/token"; urlFile = "/run/secrets/sub-url"; }
|
||||||
tag = "bad";
|
|
||||||
url = "https://example.com/sub/token";
|
|
||||||
urlFile = "/run/secrets/sub-url";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).config.system.build.toplevel.drvPath
|
];
|
||||||
);
|
|
||||||
|
|
||||||
subscriptionNoSources = forceEval (
|
subscriptionNoSources = mkBadFixtureRaw [
|
||||||
(evalProxySuite [
|
|
||||||
{
|
{
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
services.proxy-suite = {
|
services.proxy-suite = { enable = true; singBox.subscriptions = [ { tag = "bad"; } ]; };
|
||||||
enable = true;
|
|
||||||
singBox.subscriptions = [
|
|
||||||
{
|
|
||||||
tag = "bad";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
noOutboundsNoSubscriptions = forceEval (
|
noOutboundsNoSubscriptions = mkBadFixtureRaw [
|
||||||
(evalProxySuite [
|
{ system.stateVersion = "26.05"; services.proxy-suite.enable = true; }
|
||||||
{
|
];
|
||||||
system.stateVersion = "26.05";
|
|
||||||
services.proxy-suite = {
|
|
||||||
enable = true;
|
|
||||||
# neither outbounds nor subscriptions set
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]).config.system.build.toplevel.drvPath
|
|
||||||
);
|
|
||||||
|
|
||||||
blockGeoFixture = evalProxySuite [
|
blockGeoFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
|
|||||||
+13
-24
@@ -161,7 +161,7 @@ cmd_proxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_mode_toggle() {
|
cmd_mode_toggle() {
|
||||||
local name="$1" default_action="${2:-on}"
|
local name="$1" default_action="${2:-on}" display="${4:-${name#proxy-suite-}}"
|
||||||
case "${3:-$default_action}" in
|
case "${3:-$default_action}" in
|
||||||
on)
|
on)
|
||||||
systemctl start "$name"
|
systemctl start "$name"
|
||||||
@@ -170,38 +170,27 @@ cmd_mode_toggle() {
|
|||||||
systemctl stop "$name"
|
systemctl stop "$name"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: proxy-ctl ${name#proxy-suite-} on|off"
|
echo "Usage: proxy-ctl $display on|off"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_zapret() {
|
cmd_zapret() { cmd_mode_toggle "zapret-discord-youtube" on "${1:-on}" "zapret"; }
|
||||||
case "${1:-on}" in
|
|
||||||
on)
|
RESTART_SERVICES=(
|
||||||
systemctl start zapret-discord-youtube
|
proxy-suite-tproxy
|
||||||
;;
|
proxy-suite-tun
|
||||||
off)
|
zapret-discord-youtube
|
||||||
systemctl stop zapret-discord-youtube
|
)
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: proxy-ctl zapret on|off"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_restart() {
|
cmd_restart() {
|
||||||
systemctl restart proxy-suite-socks
|
systemctl restart proxy-suite-socks
|
||||||
if systemctl is-active --quiet proxy-suite-tproxy; then
|
for svc in "${RESTART_SERVICES[@]}"; do
|
||||||
systemctl restart proxy-suite-tproxy
|
if systemctl is-active --quiet "$svc"; then
|
||||||
fi
|
systemctl restart "$svc"
|
||||||
if systemctl is-active --quiet proxy-suite-tun; then
|
|
||||||
systemctl restart proxy-suite-tun
|
|
||||||
fi
|
|
||||||
if systemctl is-active --quiet zapret-discord-youtube; then
|
|
||||||
systemctl restart zapret-discord-youtube
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_outbounds() {
|
cmd_outbounds() {
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ import sys
|
|||||||
from proxy_parsing import decode_subscription, fetch_raw, parse_subscription
|
from proxy_parsing import decode_subscription, fetch_raw, parse_subscription
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# CLI
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
ap = argparse.ArgumentParser(
|
ap = argparse.ArgumentParser(
|
||||||
description="Fetch a proxy subscription URL from stdin and emit a sing-box outbound JSON array."
|
description="Fetch a proxy subscription URL from stdin and emit a sing-box outbound JSON array."
|
||||||
)
|
)
|
||||||
ap.add_argument("--tag-prefix", required=True, dest="tag_prefix",
|
ap.add_argument(
|
||||||
help="Prefix for outbound tags, e.g. 'my-sub'.")
|
"--tag-prefix",
|
||||||
|
required=True,
|
||||||
|
dest="tag_prefix",
|
||||||
|
help="Prefix for outbound tags, e.g. 'my-sub'.",
|
||||||
|
)
|
||||||
ap.add_argument("--routing-mark", type=int, default=None, dest="routing_mark")
|
ap.add_argument("--routing-mark", type=int, default=None, dest="routing_mark")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
|
|||||||
@@ -175,12 +175,7 @@ def parse_trojan(url: str, tag: str) -> dict:
|
|||||||
|
|
||||||
|
|
||||||
def parse_shadowsocks(url: str, tag: str) -> dict:
|
def parse_shadowsocks(url: str, tag: str) -> dict:
|
||||||
rest = url[len("ss://"):]
|
userinfo, host, port, _ = _parse_url_parts(url, "ss")
|
||||||
rest, _, _ = rest.partition("#")
|
|
||||||
|
|
||||||
userinfo, _, rest = rest.partition("@")
|
|
||||||
hostpart, _, _ = rest.partition("?")
|
|
||||||
host, _, port = hostpart.rpartition(":")
|
|
||||||
|
|
||||||
pad = "=" * (-len(userinfo) % 4)
|
pad = "=" * (-len(userinfo) % 4)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -17,15 +17,13 @@ def _make_b64_payload(*uris: str) -> bytes:
|
|||||||
return base64.b64encode(text.encode())
|
return base64.b64encode(text.encode())
|
||||||
|
|
||||||
|
|
||||||
def run_fetcher(server_data: bytes, tag_prefix: str = "test", *, routing_mark: int | None = None):
|
def run_fetcher(
|
||||||
|
server_data: bytes, tag_prefix: str = "test", *, routing_mark: int | None = None
|
||||||
|
):
|
||||||
lines = decode_subscription(server_data)
|
lines = decode_subscription(server_data)
|
||||||
return parse_subscription(lines, tag_prefix, routing_mark)
|
return parse_subscription(lines, tag_prefix, routing_mark)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Tests
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class FetchSubscriptionTests(unittest.TestCase):
|
class FetchSubscriptionTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_base64_payload_mixed_protocols(self):
|
def test_base64_payload_mixed_protocols(self):
|
||||||
@@ -59,6 +57,7 @@ class FetchSubscriptionTests(unittest.TestCase):
|
|||||||
tag = obs[0]["tag"]
|
tag = obs[0]["tag"]
|
||||||
# Tag must contain only safe characters
|
# Tag must contain only safe characters
|
||||||
import re
|
import re
|
||||||
|
|
||||||
self.assertRegex(tag, r"^[a-zA-Z0-9_/\-]+$")
|
self.assertRegex(tag, r"^[a-zA-Z0-9_/\-]+$")
|
||||||
|
|
||||||
def test_tag_deduplication(self):
|
def test_tag_deduplication(self):
|
||||||
|
|||||||
Reference in new issue
Block a user