refactor: remove duplication

This commit is contained in:
FUFSoB committed 2026-09-18 21:39:18 +05:00
1 parent f7036f6075
commit 8a4ba2db6a
109 files changed
+2206 -3078

No files matched your search

@@ -1,21 +1,23 @@
# Per-app TUN and TProxy backend lifecycle scripts.
{
lib,
pkgs,
builders,
perAppRoutingTun,
perAppRoutingTproxy,
ipv6,
constants,
perAppTunChainFile,
perAppTproxyRulesFile,
ip,
nft,
seqBin,
sleepBin,
}:
{ ctx }:
let
inherit (ctx)
lib
pkgs
builders
perAppRoutingTun
perAppRoutingTproxy
proxyCfg
constants
perAppTunChainFile
perAppTproxyRulesFile
ip
nft
seqBin
sleepBin
;
inherit (proxyCfg) ipv6;
inherit (constants)
perAppTunIPv6Address
perAppTunIPv6RoutePrefix
@@ -1,16 +1,18 @@
# Per-app routing profile expansion and proxychains config.
{
lib,
pkgs,
proxyCfg,
perAppRoutingCfg,
perAppRoutingTun,
perAppRoutingTproxy,
perAppZapretCfg,
runtimeDir,
}:
{ ctx }:
let
inherit (ctx)
lib
pkgs
proxyCfg
perAppRoutingCfg
perAppRoutingTun
perAppRoutingTproxy
perAppZapretCfg
constants
;
inherit (constants) runtimeDir;
perAppRoutingProfileNames = map (profile: profile.name) perAppRoutingCfg.profiles;
defaultPerAppRoutingProfiles = lib.optionals perAppRoutingCfg.createDefaultProfiles (
[
@@ -46,9 +48,7 @@ let
effectivePerAppRoutingProfileNames = map (profile: profile.name) effectivePerAppRoutingProfiles;
localProxyAuth = proxyCfg.listener.auth;
localProxyAuthEnabled =
localProxyAuth.username != null
&& (localProxyAuth.password != null || localProxyAuth.passwordFile != null);
localProxyAuthEnabled = ctx.localProxy.authEnabled;
perAppRoutingProfilesFile = pkgs.writeText "proxy-suite-per-app" (
builtins.toJSON effectivePerAppRoutingProfiles