From f991f4d685622b83c4d18335ddfd12c326a21947 Mon Sep 17 00:00:00 2001 From: FUFSoB Date: Wed, 16 Sep 2026 22:25:52 +0500 Subject: [PATCH] chore: update docs and actions --- README.md | 16 ++++++++++---- nix/checks/proxy-inbounds-runtime.nix | 30 ++++++++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e0da4eb..fd1f34f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,16 @@ # proxy-suite-flake -Declarative proxy stack for NixOS, built for dealing with Roskomnadzor and the usual Russian ISP nonsense. Configure it in Nix, rebuild, and it runs as systemd services. +Declarative proxy stack for NixOS, on either side of the connection: as a client that routes this host's traffic through outbounds, as a server that accepts clients on its own inbounds, or both at once. Configure it in Nix, rebuild, and it runs as systemd services. -Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2) and [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy). +> [!IMPORTANT] +> This project is for study and research purposes only: learning how proxies, tunnels and traffic routing work. It comes with no warranty, and the authors are not responsible for how it is used. + +> [!NOTE] +> This project is developed with AI assistance: much of the code and documentation was written with AI tools, then reviewed and tested on real-world setups. + +Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2) and [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy); see their repositories for their own licenses and documentation. + +Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [3x-ui](https://github.com/MHSanaei/3x-ui) and other similar projects. ## Features @@ -58,7 +66,7 @@ services.proxy-suite = { zapret.enable = true; }; - zapret.enable = true; + zapret.enable = true; # default is zapret-discord-youtube sshProxy = { enable = true; @@ -85,7 +93,7 @@ services.proxy-suite = { # Registers with wgcf on first start. The exit is Cloudflare, but geolocated to your own country. warp = { enable = true; - asOutbound = "singBox"; # tag "warp"; "interface" runs it as an AmneziaWG profile + asOutbound = "singBox"; # tag is "warp"; asOutbound = "interface" runs it as an AmneziaWG profile # asAmneziaWg = true; # or a global profile instead: proxy-ctl awg on warp }; diff --git a/nix/checks/proxy-inbounds-runtime.nix b/nix/checks/proxy-inbounds-runtime.nix index eecf16c..d773231 100644 --- a/nix/checks/proxy-inbounds-runtime.nix +++ b/nix/checks/proxy-inbounds-runtime.nix @@ -10,12 +10,18 @@ let ssPassword = "dGhpcy1pcy1hLTE2Ynl0ZS1rZXk="; # Public addresses: blockPrivate would refuse the origin on a private one. serverAddress = "11.0.0.1"; + # XRay refuses plain VLESS to a public IP, so the client dials a private one. + serverPrivateAddress = "10.0.0.1"; - network = address: { + network = public: private: { networking.useDHCP = false; networking.interfaces.eth1.ipv4.addresses = [ { - inherit address; + address = public; + prefixLength = 24; + } + { + address = private; prefixLength = 24; } ]; @@ -31,7 +37,7 @@ pkgs.testers.runNixOSTest { { imports = [ proxySuiteModule - (network serverAddress) + (network serverAddress serverPrivateAddress) ]; services.proxy-suite = { @@ -48,7 +54,7 @@ pkgs.testers.runNixOSTest { users = [ { name = "tester"; - inherit uuid; + uuidFile = "/run/inbound-secrets/uuid"; } ]; }; @@ -56,7 +62,7 @@ pkgs.testers.runNixOSTest { type = "shadowsocks"; port = 8388; method = "2022-blake3-aes-128-gcm"; - users = [ { password = ssPassword; } ]; + users = [ { passwordFile = "/run/inbound-secrets/password"; } ]; }; }; }; @@ -66,6 +72,14 @@ pkgs.testers.runNixOSTest { virtualHosts."origin".locations."/".return = "200 'served-from-origin'"; }; networking.firewall.allowedTCPPorts = [ 80 ]; + # Written at boot, so the listener's spec carries only the paths. + systemd.tmpfiles.rules = [ + "d /run/inbound-secrets 0700 root root -" + "f+ /run/inbound-secrets/uuid 0400 root root - ${uuid}" + "f+ /run/inbound-secrets/password 0400 root root - ${ssPassword}" + ]; + # The test script inspects the rendered config with jq. + environment.systemPackages = [ pkgs.jq ]; }; client = @@ -73,7 +87,7 @@ pkgs.testers.runNixOSTest { { imports = [ proxySuiteModule - (network "11.0.0.2") + (network "11.0.0.2" "10.0.0.2") ]; services.proxy-suite = { @@ -85,7 +99,7 @@ pkgs.testers.runNixOSTest { outbounds = [ { tag = "server"; - url = "vless://${uuid}@${serverAddress}:8443?type=tcp&security=none"; + url = "vless://${uuid}@${serverPrivateAddress}:8443?type=tcp&security=none"; } ]; }; @@ -137,7 +151,7 @@ pkgs.testers.runNixOSTest { server.succeed(f"test $(jq -r 'length' {links}) = 2") link = server.succeed("proxy-ctl inbounds link vless-in").strip() assert link.startswith("vless://${uuid}@${serverAddress}:8443"), link - assert "#tester" in link, link + assert "tester" in link, link server.succeed("proxy-ctl inbounds | grep -q vless-in") server.succeed("proxy-ctl inbounds link vless-in --qr | head -c 1") server.succeed("proxy-ctl status | grep -q proxy-suite-inbounds")