fix: multiple fixes
This commit is contained in:
22 files changed
+107
-92
No files matched your search
@@ -95,7 +95,7 @@ null or package
|
|||||||
*Default:*
|
*Default:*
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
<derivation amneziawg-3.1.20260812>
|
<derivation amneziawg-3.1.20260828>
|
||||||
```
|
```
|
||||||
|
|
||||||
<a id="services-proxy-suite-amneziawg-profiles"></a>
|
<a id="services-proxy-suite-amneziawg-profiles"></a>
|
||||||
|
|||||||
@@ -60,9 +60,12 @@
|
|||||||
nixosModules.zapret = zapret.nixosModules.default;
|
nixosModules.zapret = zapret.nixosModules.default;
|
||||||
|
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
inherit (import ./pkgs/default.nix { pkgs = final; })
|
# From prev: these override the nixpkgs packages of the same name.
|
||||||
|
inherit (import ./pkgs/default.nix { pkgs = prev; })
|
||||||
amneziawg-tools
|
amneziawg-tools
|
||||||
amneziawg-go
|
amneziawg-go
|
||||||
|
;
|
||||||
|
inherit (import ./pkgs/default.nix { pkgs = final; })
|
||||||
mkProxyCtl
|
mkProxyCtl
|
||||||
mkTgWsProxy
|
mkTgWsProxy
|
||||||
tg-ws-proxy
|
tg-ws-proxy
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ let
|
|||||||
|
|
||||||
implementation="$(${pkgs.python3}/bin/python3 ${configTool} \
|
implementation="$(${pkgs.python3}/bin/python3 ${configTool} \
|
||||||
--transport-implementation ${lib.escapeShellArg configPath})"
|
--transport-implementation ${lib.escapeShellArg configPath})"
|
||||||
# The 3.1.20260812 kernel module drops RandomTrailers packets with ranged H1-H3;
|
# The 3.1 kernel module dropped RandomTrailers packets with ranged H1-H3 (seen on 20260812);
|
||||||
# userspace carries the fix.
|
# userspace carries the fix.
|
||||||
if [[ "$implementation" == userspace ]]; then
|
if [[ "$implementation" == userspace ]]; then
|
||||||
WG_QUICK_FORCE_USERSPACE_IMPLEMENTATION=1 \
|
WG_QUICK_FORCE_USERSPACE_IMPLEMENTATION=1 \
|
||||||
|
|||||||
@@ -406,7 +406,8 @@ let
|
|||||||
"proxy-suite-socks.service"
|
"proxy-suite-socks.service"
|
||||||
"proxy-suite-inbounds.service"
|
"proxy-suite-inbounds.service"
|
||||||
];
|
];
|
||||||
wants = [ "proxy-suite-socks.service" ];
|
# No wants: a timer run must not start a proxy stopped on purpose; without
|
||||||
|
# its listeners the runner has nothing to do and says so.
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${runner}${args}";
|
ExecStart = "${runner}${args}";
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ in
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
xray = import ../../pkgs/xray.nix { pkgs = upstream; };
|
xray = import ../../pkgs/xray.nix { pkgs = upstream; };
|
||||||
|
# AWG 3.1 userspace; its kernel module has to match the system's kernel instead.
|
||||||
|
amneziaWg = import ../../pkgs/amneziawg.nix { pkgs = upstream; };
|
||||||
inherit (upstream) sing-box;
|
inherit (upstream) sing-box;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
proxySuiteUpstream,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ let
|
|||||||
types
|
types
|
||||||
;
|
;
|
||||||
t = import ./types.nix { inherit lib; };
|
t = import ./types.nix { inherit lib; };
|
||||||
awgPackages = import ../../../pkgs/amneziawg.nix { inherit pkgs; };
|
awgPackages = proxySuiteUpstream.amneziaWg;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.proxy-suite.amneziaWg = {
|
options.services.proxy-suite.amneziaWg = {
|
||||||
|
|||||||
@@ -18,18 +18,18 @@ let
|
|||||||
systemctl = "${pkgs.systemd}/bin/systemctl";
|
systemctl = "${pkgs.systemd}/bin/systemctl";
|
||||||
curl = "${pkgs.curl}/bin/curl";
|
curl = "${pkgs.curl}/bin/curl";
|
||||||
|
|
||||||
restartActiveConfigConsumersBlock =
|
restartActiveBlock = lib.concatMapStrings (svc: ''
|
||||||
lib.concatMapStrings
|
if ${systemctl} is-active --quiet ${svc}; then
|
||||||
(svc: ''
|
${systemctl} restart ${svc}
|
||||||
if ${systemctl} is-active --quiet ${svc}; then
|
fi
|
||||||
${systemctl} restart ${svc}
|
'');
|
||||||
fi
|
|
||||||
'')
|
# The TUN backends are sing-box instances of their own, without a Clash API.
|
||||||
[
|
tunConsumers = [
|
||||||
"proxy-suite-socks"
|
"proxy-suite-tun"
|
||||||
"proxy-suite-tun"
|
"proxy-suite-per-app-tun"
|
||||||
"proxy-suite-per-app-tun"
|
];
|
||||||
];
|
restartActiveConfigConsumersBlock = restartActiveBlock ([ "proxy-suite-socks" ] ++ tunConsumers);
|
||||||
|
|
||||||
subscriptionUpdateScript = pkgs.writeShellScript "proxy-suite-core" ''
|
subscriptionUpdateScript = pkgs.writeShellScript "proxy-suite-core" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -102,6 +102,7 @@ let
|
|||||||
if ${curl} -sf -X PUT "${clashApi}/proxies/proxy" \
|
if ${curl} -sf -X PUT "${clashApi}/proxies/proxy" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$(${jq} -cn --arg name "$tag" '{name:$name}')" >/dev/null 2>&1; then
|
-d "$(${jq} -cn --arg name "$tag" '{name:$name}')" >/dev/null 2>&1; then
|
||||||
|
${restartActiveBlock tunConsumers}
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ let
|
|||||||
cgroup_level=$(printf '%s' "$cgroup_path" | ${awk} -F/ '{ print NF }')
|
cgroup_level=$(printf '%s' "$cgroup_path" | ${awk} -F/ '{ print NF }')
|
||||||
|
|
||||||
handles=$(${nft} -a list chain ${nftFamily} ${nftTable} ${nftChain} 2>/dev/null \
|
handles=$(${nft} -a list chain ${nftFamily} ${nftTable} ${nftChain} 2>/dev/null \
|
||||||
| ${grepBin} -F "comment \"$rule_comment_prefix" \
|
| ${grepBin} -F "comment \"$rule_comment_prefix-mark\"" \
|
||||||
| ${awk} '{ print $NF }' || true)
|
| ${awk} '{ print $NF }' || true)
|
||||||
if [ -n "$handles" ]; then
|
if [ -n "$handles" ]; then
|
||||||
while IFS= read -r handle; do
|
while IFS= read -r handle; do
|
||||||
@@ -72,7 +72,7 @@ let
|
|||||||
uid="$1"
|
uid="$1"
|
||||||
rule_comment_prefix="proxy-suite-${name}-user-$uid"
|
rule_comment_prefix="proxy-suite-${name}-user-$uid"
|
||||||
handles=$(${nft} -a list chain ${nftFamily} ${nftTable} ${nftChain} 2>/dev/null \
|
handles=$(${nft} -a list chain ${nftFamily} ${nftTable} ${nftChain} 2>/dev/null \
|
||||||
| ${grepBin} -F "comment \"$rule_comment_prefix" \
|
| ${grepBin} -F "comment \"$rule_comment_prefix-mark\"" \
|
||||||
| ${awk} '{ print $NF }' || true)
|
| ${awk} '{ print $NF }' || true)
|
||||||
if [ -n "$handles" ]; then
|
if [ -n "$handles" ]; then
|
||||||
while IFS= read -r handle; do
|
while IFS= read -r handle; do
|
||||||
|
|||||||
@@ -354,9 +354,10 @@ let
|
|||||||
|
|
||||||
${singBox} run -c "$RUNTIME_DIR/config.json" &
|
${singBox} run -c "$RUNTIME_DIR/config.json" &
|
||||||
SING_BOX_PID="$!"
|
SING_BOX_PID="$!"
|
||||||
|
# Either one going away breaks the outbounds: exit, and let systemd restart both.
|
||||||
SING_BOX_STATUS=0
|
SING_BOX_STATUS=0
|
||||||
wait "$SING_BOX_PID" || SING_BOX_STATUS="$?"
|
wait -n "$XRAY_SIDECAR_PID" "$SING_BOX_PID" || SING_BOX_STATUS="$?"
|
||||||
exit "$SING_BOX_STATUS"
|
exit "$(( SING_BOX_STATUS == 0 ? 1 : SING_BOX_STATUS ))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${singBox} run -c "$RUNTIME_DIR/config.json"
|
exec ${singBox} run -c "$RUNTIME_DIR/config.json"
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ let
|
|||||||
wants = [ "network-online.target" ];
|
wants = [ "network-online.target" ];
|
||||||
execStart = scripts.subscriptionUpdateScript;
|
execStart = scripts.subscriptionUpdateScript;
|
||||||
stateDirectory = "proxy-suite";
|
stateDirectory = "proxy-suite";
|
||||||
|
# Run by a timer and by `proxy subs update`: a unit left "active" would never run again.
|
||||||
|
extraServiceConfig.RemainAfterExit = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ let
|
|||||||
t = cfg.tgWsProxy;
|
t = cfg.tgWsProxy;
|
||||||
tgPkg = packages.tg-ws-proxy;
|
tgPkg = packages.tg-ws-proxy;
|
||||||
ip = "${pkgs.iproute2}/bin/ip";
|
ip = "${pkgs.iproute2}/bin/ip";
|
||||||
|
nft = "${pkgs.nftables}/bin/nft";
|
||||||
|
markTable = "proxy_suite_tg_ws_proxy";
|
||||||
|
|
||||||
transparentBypassEnabled =
|
transparentBypassEnabled =
|
||||||
t.bypassTransparentProxy && cfg.proxy.enable && (cfg.proxy.tun.enable || cfg.proxy.tproxy.enable);
|
t.bypassTransparentProxy && cfg.proxy.enable && (cfg.proxy.tun.enable || cfg.proxy.tproxy.enable);
|
||||||
@@ -59,6 +61,18 @@ let
|
|||||||
|
|
||||||
add_bypass_rule -4
|
add_bypass_rule -4
|
||||||
add_bypass_rule -6
|
add_bypass_rule -6
|
||||||
|
|
||||||
|
# The relay's own sockets carry the mark. By cgroup, which is resolved when the rule
|
||||||
|
# loads: this runs again on every start. Ahead of the TProxy output chain.
|
||||||
|
${nft} delete table inet ${markTable} 2>/dev/null || true
|
||||||
|
${nft} -f - <<EOF
|
||||||
|
table inet ${markTable} {
|
||||||
|
chain output {
|
||||||
|
type route hook output priority mangle - 1; policy accept;
|
||||||
|
socket cgroupv2 level 2 "system.slice/proxy-suite-tg-ws-proxy.service" meta mark set ${toString t.fwmark}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
bypassDownScript = pkgs.writeShellScript "proxy-suite-tg-ws-proxy" ''
|
bypassDownScript = pkgs.writeShellScript "proxy-suite-tg-ws-proxy" ''
|
||||||
@@ -66,6 +80,7 @@ let
|
|||||||
|
|
||||||
while ${ip} -4 rule del pref ${toString bypassRulePriority} fwmark ${toString t.fwmark} lookup main 2>/dev/null; do :; done
|
while ${ip} -4 rule del pref ${toString bypassRulePriority} fwmark ${toString t.fwmark} lookup main 2>/dev/null; do :; done
|
||||||
while ${ip} -6 rule del pref ${toString bypassRulePriority} fwmark ${toString t.fwmark} lookup main 2>/dev/null; do :; done
|
while ${ip} -6 rule del pref ${toString bypassRulePriority} fwmark ${toString t.fwmark} lookup main 2>/dev/null; do :; done
|
||||||
|
${nft} delete table inet ${markTable} 2>/dev/null
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -83,7 +98,6 @@ in
|
|||||||
// lib.optionalAttrs transparentBypassEnabled {
|
// lib.optionalAttrs transparentBypassEnabled {
|
||||||
ExecStartPre = bypassUpScript;
|
ExecStartPre = bypassUpScript;
|
||||||
ExecStopPost = bypassDownScript;
|
ExecStopPost = bypassDownScript;
|
||||||
SocketMark = toString t.fwmark;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -119,13 +119,23 @@ in
|
|||||||
|
|
||||||
systemd.services.proxy-suite-zapret-vm-exempt =
|
systemd.services.proxy-suite-zapret-vm-exempt =
|
||||||
lib.mkIf (zapretCfg.enable && zapretCfg.cidrExemption.enable)
|
lib.mkIf (zapretCfg.enable && zapretCfg.cidrExemption.enable)
|
||||||
(mkOneshotService {
|
(
|
||||||
description = "Exempt CIDRs from zapret NFQUEUE";
|
mkOneshotService {
|
||||||
after = [ "proxy-suite-zapret.service" ];
|
description = "Exempt CIDRs from zapret NFQUEUE";
|
||||||
wants = [ "proxy-suite-zapret.service" ];
|
after = [ "proxy-suite-zapret.service" ];
|
||||||
conflicts = awgServiceNames;
|
wants = [ "proxy-suite-zapret.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
conflicts = awgServiceNames;
|
||||||
execStart = pkgs.writeShellScript "proxy-suite-zapret" exemptStart;
|
# zapret inserts its rules at the top (iptables -I): these are re-inserted after
|
||||||
execStop = pkgs.writeShellScript "proxy-suite-zapret" exemptStop;
|
# every zapret start or restart, or they end up below its NFQUEUE jumps.
|
||||||
});
|
wantedBy = [
|
||||||
|
"multi-user.target"
|
||||||
|
"proxy-suite-zapret.service"
|
||||||
|
];
|
||||||
|
execStart = pkgs.writeShellScript "proxy-suite-zapret" exemptStart;
|
||||||
|
execStop = pkgs.writeShellScript "proxy-suite-zapret" exemptStop;
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
partOf = [ "proxy-suite-zapret.service" ];
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -197,8 +197,8 @@ in
|
|||||||
awgOnly.config.environment.systemPackages;
|
awgOnly.config.environment.systemPackages;
|
||||||
assert builtins.elem awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage
|
assert builtins.elem awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage
|
||||||
awgOnly.config.environment.systemPackages;
|
awgOnly.config.environment.systemPackages;
|
||||||
assert awgOnly.config.services.proxy-suite.amneziaWg.toolsPackage.version == "3.1.20260812";
|
assert pkgs.lib.versionAtLeast awgOnly.config.services.proxy-suite.amneziaWg.toolsPackage.version "3.1";
|
||||||
assert awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage.version == "3.1.20260828";
|
assert pkgs.lib.versionAtLeast awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage.version "3.1";
|
||||||
assert pkgs.lib.hasInfix "cmd_awg" ctl.script;
|
assert pkgs.lib.hasInfix "cmd_awg" ctl.script;
|
||||||
assert
|
assert
|
||||||
ctl.awgProfiles == [
|
ctl.awgProfiles == [
|
||||||
@@ -208,11 +208,11 @@ in
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
assert defaultPackages.config.services.proxy-suite.amneziaWg.toolsPackage.version == "3.1.20260812";
|
assert pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.toolsPackage.version "3.1";
|
||||||
assert
|
assert
|
||||||
defaultPackages.config.services.proxy-suite.amneziaWg.userspacePackage.version == "3.1.20260828";
|
pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.userspacePackage.version "3.1";
|
||||||
assert
|
assert
|
||||||
defaultPackages.config.services.proxy-suite.amneziaWg.kernelModulePackage.version == "3.1.20260812";
|
pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.kernelModulePackage.version "3.1";
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ in
|
|||||||
assert subscriptionOnlyFixture.config.systemd.timers ? "proxy-suite-subscription-update";
|
assert subscriptionOnlyFixture.config.systemd.timers ? "proxy-suite-subscription-update";
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
# A oneshot left active would swallow every later timer run.
|
||||||
|
(
|
||||||
|
assert
|
||||||
|
!subscriptionOnlyFixture.config.systemd.services."proxy-suite-subscription-update".serviceConfig.RemainAfterExit;
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
# StateDirectory is set on the socks service.
|
# StateDirectory is set on the socks service.
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ in
|
|||||||
|
|
||||||
# Global TUN/TProxy bypass mark keeps relay traffic out of transparent capture.
|
# Global TUN/TProxy bypass mark keeps relay traffic out of transparent capture.
|
||||||
(
|
(
|
||||||
assert tgWithGlobalTunServiceConfig.SocketMark == "4";
|
assert !(tgWithGlobalTunServiceConfig ? SocketMark);
|
||||||
|
assert pkgs.lib.hasInfix "\"system.slice/proxy-suite-tg-ws-proxy.service\" meta mark set 4" tgWithGlobalTunBypassUp;
|
||||||
|
assert pkgs.lib.hasInfix "delete table inet proxy_suite_tg_ws_proxy" tgWithGlobalTunBypassDown;
|
||||||
assert pkgs.lib.hasInfix "rule add pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassUp;
|
assert pkgs.lib.hasInfix "rule add pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassUp;
|
||||||
assert pkgs.lib.hasInfix "rule del pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassDown;
|
assert pkgs.lib.hasInfix "rule del pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassDown;
|
||||||
assert hasDirectIP tgWithGlobalTunRules "149.154.167.220";
|
assert hasDirectIP tgWithGlobalTunRules "149.154.167.220";
|
||||||
|
|||||||
+5
-43
@@ -1,50 +1,12 @@
|
|||||||
|
# nixpkgs' AmneziaWG 3.1 packages plus this suite's patches.
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
|
|
||||||
let
|
{
|
||||||
# Tools and the kernel module currently publish 3.1.20260812, while the
|
|
||||||
# userspace implementation has follow-up 3.1 fixes through 20260828.
|
|
||||||
# nixpkgs itself still tracks AWG 3.0.
|
|
||||||
version = "3.1.20260812";
|
|
||||||
userspaceVersion = "3.1.20260828";
|
|
||||||
tools = pkgs.amneziawg-tools.overrideAttrs (old: {
|
tools = pkgs.amneziawg-tools.overrideAttrs (old: {
|
||||||
inherit version;
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "amnezia-vpn";
|
|
||||||
repo = "amneziawg-tools";
|
|
||||||
tag = "v${version}";
|
|
||||||
hash = "sha256-6GEb41ERhR0Hg3RbSyIHdXPSKaxugoFCmFS5S0UiZso=";
|
|
||||||
};
|
|
||||||
patches = (old.patches or [ ]) ++ [ ./patches/amneziawg-tools-force-userspace.patch ];
|
patches = (old.patches or [ ]) ++ [ ./patches/amneziawg-tools-force-userspace.patch ];
|
||||||
});
|
});
|
||||||
userspace = pkgs.amneziawg-go.overrideAttrs (_: {
|
userspace = pkgs.amneziawg-go.overrideAttrs (old: {
|
||||||
version = userspaceVersion;
|
patches = (old.patches or [ ]) ++ [ ./patches/amneziawg-go-random-trailers-transport.patch ];
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "amnezia-vpn";
|
|
||||||
repo = "amneziawg-go";
|
|
||||||
tag = "v${userspaceVersion}";
|
|
||||||
hash = "sha256-vZb72SA+6v8FXZX247K05yiVEBWpLqAAIyw6bEE4eUQ=";
|
|
||||||
};
|
|
||||||
patches = [ ./patches/amneziawg-go-random-trailers-transport.patch ];
|
|
||||||
# The 3.1 releases keep the dependency set used by nixpkgs' 3.0 package.
|
|
||||||
vendorHash = "sha256-Y2dCwlKMVLrkzDcNKyCPxFJwMbCA2mQKkakvzwbamCY=";
|
|
||||||
});
|
});
|
||||||
|
kernelModule = kernelPackages: kernelPackages.amneziawg;
|
||||||
kernelModule = kernelPackages: kernelPackages.amneziawg.overrideAttrs (_: {
|
|
||||||
inherit version;
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "amnezia-vpn";
|
|
||||||
repo = "amneziawg-linux-kernel-module";
|
|
||||||
tag = "v${version}";
|
|
||||||
hash = "sha256-dJ7Au4J8iPlphSzTa3Gol/LMlroroSc2IUmXZfjA0k8=";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit
|
|
||||||
version
|
|
||||||
userspaceVersion
|
|
||||||
tools
|
|
||||||
userspace
|
|
||||||
kernelModule
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
@@ -544,6 +544,9 @@ def _overall_state(snapshot):
|
|||||||
label = "Proxy only" if label == "Proxy" else label
|
label = "Proxy only" if label == "Proxy" else label
|
||||||
elif snapshot["awg"]["active"]:
|
elif snapshot["awg"]["active"]:
|
||||||
label = "AmneziaWG"
|
label = "AmneziaWG"
|
||||||
|
elif traffic:
|
||||||
|
# TUN runs its own backend, without proxy-suite-socks.
|
||||||
|
label = "TUN" + (" + zapret" if zapret else "")
|
||||||
else:
|
else:
|
||||||
label = "Zapret only" if zapret else "Inactive"
|
label = "Zapret only" if zapret else "Inactive"
|
||||||
units = snapshot.get("units") or {}
|
units = snapshot.get("units") or {}
|
||||||
@@ -2350,7 +2353,8 @@ ALIASES = {
|
|||||||
|
|
||||||
def cmd_logs(*units):
|
def cmd_logs(*units):
|
||||||
if units:
|
if units:
|
||||||
_exec(["journalctl", "-fu", *units])
|
# One -u per unit: a bare second name would be taken as a journal match.
|
||||||
|
_exec(["journalctl", "-f", *(f"--unit={u}" for u in units)])
|
||||||
# journalctl takes unit globs, so the default needs no unit list of its own.
|
# journalctl takes unit globs, so the default needs no unit list of its own.
|
||||||
_exec(["journalctl", "-f", "-u", "proxy-suite-*"])
|
_exec(["journalctl", "-f", "-u", "proxy-suite-*"])
|
||||||
|
|
||||||
|
|||||||
@@ -297,6 +297,10 @@ def _enabled(name):
|
|||||||
return lambda _: ctl.env(name) == "1"
|
return lambda _: ctl.env(name) == "1"
|
||||||
|
|
||||||
|
|
||||||
|
def _sub_url(row):
|
||||||
|
return bool(row["user"]) and bool(ctl.env("INBOUNDS_SUB_BASE_URL"))
|
||||||
|
|
||||||
|
|
||||||
def _zapret_toggle(row, _, states):
|
def _zapret_toggle(row, _, states):
|
||||||
return ["zapret", "off" if states.get("proxy-suite-zapret") == "active" else "on"]
|
return ["zapret", "off" if states.get("proxy-suite-zapret") == "active" else "on"]
|
||||||
|
|
||||||
@@ -412,8 +416,9 @@ TABS = [
|
|||||||
Action("c", "copy share link", lambda r, *_: _link(r), when=ROW, mode="copy"),
|
Action("c", "copy share link", lambda r, *_: _link(r), when=ROW, mode="copy"),
|
||||||
Action("Q", "share link as QR", lambda r, *_: _link(r, "--qr"), when=ROW, mode="dialog"),
|
Action("Q", "share link as QR", lambda r, *_: _link(r, "--qr"), when=ROW, mode="dialog"),
|
||||||
Action("s", "subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=lambda r: bool(r["user"]), mode="dialog"),
|
Action("s", "subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=lambda r: bool(r["user"]), mode="dialog"),
|
||||||
Action("S", "subscription URL as QR", lambda r, *_: ["inbounds", "sub", r["user"], "--qr"], when=lambda r: bool(r["user"]), mode="dialog"),
|
# Without subscriptions.baseUrl there is only a file path, with a hint after it: nothing to encode or copy.
|
||||||
Action("y", "copy subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=lambda r: bool(r["user"]), mode="copy"),
|
Action("S", "subscription URL as QR", lambda r, *_: ["inbounds", "sub", r["user"], "--qr"], when=_sub_url, mode="dialog"),
|
||||||
|
Action("y", "copy subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=_sub_url, mode="copy"),
|
||||||
Action("t", "traffic per user", lambda r, *_: ["inbounds", "stats"], mode="dialog"),
|
Action("t", "traffic per user", lambda r, *_: ["inbounds", "stats"], mode="dialog"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -607,7 +607,11 @@ class ProxyTui(App):
|
|||||||
|
|
||||||
def perform(self, action, row):
|
def perform(self, action, row):
|
||||||
def with_text(text=""):
|
def with_text(text=""):
|
||||||
argv = action.argv(row, text, self.states)
|
try:
|
||||||
|
argv = action.argv(row, text, self.states)
|
||||||
|
except (ValueError, IndexError) as e: # an unbalanced quote in a typed command
|
||||||
|
self.feedback(f"Cannot run that: {e}", False)
|
||||||
|
return
|
||||||
confirm = action.confirm(row) if callable(action.confirm) else action.confirm
|
confirm = action.confirm(row) if callable(action.confirm) else action.confirm
|
||||||
if confirm:
|
if confirm:
|
||||||
self.push_screen(Confirm(f"proxy-ctl {shlex.join(argv)}"), lambda ok: ok and self.run_argv(action.mode, argv))
|
self.push_screen(Confirm(f"proxy-ctl {shlex.join(argv)}"), lambda ok: ok and self.run_argv(action.mode, argv))
|
||||||
|
|||||||
@@ -624,6 +624,7 @@ class StatusSnapshotTest(EnvTest):
|
|||||||
both = self.overall(socks="active", zapret="active", tun="active")
|
both = self.overall(socks="active", zapret="active", tun="active")
|
||||||
self.assertEqual((both["base"], both["label"]), ("tunnel", "Proxy + traffic + zapret"))
|
self.assertEqual((both["base"], both["label"]), ("tunnel", "Proxy + traffic + zapret"))
|
||||||
self.assertEqual(self.overall(awg_work="active"), {"base": "tunnel", "badge": "", "label": "AmneziaWG"})
|
self.assertEqual(self.overall(awg_work="active"), {"base": "tunnel", "badge": "", "label": "AmneziaWG"})
|
||||||
|
self.assertEqual(self.overall(tun="active")["label"], "TUN")
|
||||||
|
|
||||||
def test_badges(self):
|
def test_badges(self):
|
||||||
self.assertEqual(self.overall(socks="active", tun="failed")["badge"], "failed")
|
self.assertEqual(self.overall(socks="active", tun="failed")["badge"], "failed")
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if ! command -v jq >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
system="${NIXPKGS_WATCH_SYSTEM:-x86_64-linux}"
|
system="${NIXPKGS_WATCH_SYSTEM:-x86_64-linux}"
|
||||||
default_watch_attrs="sing-box,proxychains-ng,sing-geosite,sing-geoip,nftables,iproute2,iptables,ipset,python3,python3Packages.requests,python3Packages.websockets,python3Packages.cryptography,gtk3,libayatana-appindicator"
|
default_watch_attrs="sing-box,proxychains-ng,sing-geosite,sing-geoip,nftables,iproute2,iptables,ipset,python3,python3Packages.requests,python3Packages.websockets,python3Packages.cryptography,gtk4,libadwaita,amneziawg-tools,amneziawg-go,linuxPackages.amneziawg"
|
||||||
watch_attrs_csv="${NIXPKGS_WATCH_ATTRS:-$default_watch_attrs}"
|
watch_attrs_csv="${NIXPKGS_WATCH_ATTRS:-$default_watch_attrs}"
|
||||||
|
|
||||||
IFS=',' read -r -a watch_attrs <<< "$watch_attrs_csv"
|
IFS=',' read -r -a watch_attrs <<< "$watch_attrs_csv"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Table columns: nix-file|owner|repo|version-key|flake-attr
|
# Table columns: nix-file|owner|repo|version-key|flake-attr
|
||||||
# version-key the `<key> = "...";` line holding the tag. A leading "=" means
|
# version-key the `<key> = "...";` line holding the tag. A leading "=" means
|
||||||
# "do not query GitHub, reuse the value of that key" - for sources
|
# "do not query GitHub, reuse the value of that key" - for sources
|
||||||
# that must stay in lockstep (AWG kernel module follows tools).
|
# that must stay in lockstep.
|
||||||
# flake-attr package built to recompute vendorHash; "-" when there is none.
|
# flake-attr package built to recompute vendorHash; "-" when there is none.
|
||||||
#
|
#
|
||||||
# Prints one "updated <repo>: <old> -> <new>" line per change on stdout; progress
|
# Prints one "updated <repo>: <old> -> <new>" line per change on stdout; progress
|
||||||
@@ -16,9 +16,6 @@ PINS=(
|
|||||||
"pkgs/tg-ws-proxy.nix|Flowseal|tg-ws-proxy|rev|tg-ws-proxy"
|
"pkgs/tg-ws-proxy.nix|Flowseal|tg-ws-proxy|rev|tg-ws-proxy"
|
||||||
"pkgs/zapret2.nix|bol-van|zapret2|version|zapret2"
|
"pkgs/zapret2.nix|bol-van|zapret2|version|zapret2"
|
||||||
"pkgs/xray.nix|XTLS|Xray-core|version|xray"
|
"pkgs/xray.nix|XTLS|Xray-core|version|xray"
|
||||||
"pkgs/amneziawg.nix|amnezia-vpn|amneziawg-tools|version|amneziawg-tools"
|
|
||||||
"pkgs/amneziawg.nix|amnezia-vpn|amneziawg-go|userspaceVersion|amneziawg-go"
|
|
||||||
"pkgs/amneziawg.nix|amnezia-vpn|amneziawg-linux-kernel-module|=version|-"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||||
@@ -64,7 +61,7 @@ get_key() {
|
|||||||
|
|
||||||
# Replace `<attr> = "...";` with val. When repo is non-empty the search is scoped
|
# Replace `<attr> = "...";` with val. When repo is non-empty the search is scoped
|
||||||
# to the fetchFromGitHub block of that repo, so sibling pins in the same file
|
# to the fetchFromGitHub block of that repo, so sibling pins in the same file
|
||||||
# (amneziawg.nix holds three) never clobber each other. Returns 1 if not found.
|
# never clobber each other. Returns 1 if not found.
|
||||||
set_attr() {
|
set_attr() {
|
||||||
local file=$1 repo=$2 attr=$3 val=$4 tmp
|
local file=$1 repo=$2 attr=$3 val=$4 tmp
|
||||||
tmp=$(mktemp)
|
tmp=$(mktemp)
|
||||||
@@ -110,7 +107,7 @@ refresh_vendor_hash() {
|
|||||||
|
|
||||||
|
|
||||||
# `--self-test`: the one thing that must not break is set_attr's block scoping -
|
# `--self-test`: the one thing that must not break is set_attr's block scoping -
|
||||||
# amneziawg.nix holds three fetchFromGitHub blocks and a vendorHash that belongs
|
# a file may hold several fetchFromGitHub blocks and a vendorHash that belongs
|
||||||
# to exactly one of them.
|
# to exactly one of them.
|
||||||
self_test() {
|
self_test() {
|
||||||
local d f
|
local d f
|
||||||
|
|||||||
Reference in new issue
Block a user