refactor: overhaul of options and features

Includes, but not limited to:
- zapret2 support
- declarative inbounds
- proxy-ctl revamp
- automatic proxy learning
This commit is contained in:
FUFSoB committed 2026-09-13 22:37:45 +05:00
1 parent b892384527
commit fdb2b08790
144 files changed
+13198 -14066

No files matched your search

+42 -18
View File
@@ -21,6 +21,19 @@
amneziaWgProfileNamesFile,
inboundsEnabled,
inboundsLinksFile,
inboundsStatsFile,
inboundsSubscriptionsFile,
inboundsSubscriptionsBaseUrl,
zapretAutoEnabled,
zapretStateDir,
priorityOutboundFile,
outboundInventoryFile,
runtimeOutboundsDir,
runtimeSubscriptionsDir,
userControlGroup,
localProxyUrl,
autoProxyEnabled,
autoProxyStateDir,
}:
let
@@ -45,6 +58,19 @@ let
AWG_PROFILES_FILE = toString amneziaWgProfileNamesFile;
INBOUNDS_ENABLED = inboundsEnabled;
INBOUNDS_LINKS_FILE = inboundsLinksFile;
INBOUNDS_STATS_FILE = inboundsStatsFile;
INBOUNDS_SUBS_FILE = inboundsSubscriptionsFile;
INBOUNDS_SUB_BASE_URL = inboundsSubscriptionsBaseUrl;
ZAPRET_AUTO_ENABLED = zapretAutoEnabled;
ZAPRET_STATE_DIR = zapretStateDir;
PRIORITY_OUTBOUND_FILE = priorityOutboundFile;
OUTBOUND_INVENTORY_FILE = outboundInventoryFile;
RUNTIME_OUTBOUNDS_DIR = runtimeOutboundsDir;
RUNTIME_SUBS_DIR = runtimeSubscriptionsDir;
USER_CONTROL_GROUP = userControlGroup;
LOCAL_PROXY_URL = localProxyUrl;
AUTOPROXY_ENABLED = autoProxyEnabled;
AUTOPROXY_STATE_DIR = autoProxyStateDir;
};
in
pkgs.symlinkJoin {
@@ -61,12 +87,23 @@ pkgs.symlinkJoin {
;
script = unwrapped.drvAttrs.text;
};
# Probes present a browser's TLS fingerprint: bot protection refuses plain
# curl. The newest Chrome profile the package ships, since the set varies by
# version; the build fails if there is none.
postBuild = ''
install -Dm644 ${./proxy-ctl-completion.bash} \
"$out/share/bash-completion/completions/proxy-ctl"
probe_curl=$(ls ${pkgs.curl-impersonate}/bin/curl_chrome[0-9]* | grep -E '/curl_chrome[0-9]+$' | sort -V | tail -n 1)
[ -x "$probe_curl" ]
wrapProgram "$out/bin/proxy-ctl" \
--set PROBE_CURL "$probe_curl" \
--prefix PATH : "${
lib.makeBinPath [
# curl-impersonate's curl_chrome* wrappers are `#!/usr/bin/env bash`.
pkgs.bash
pkgs.coreutils
pkgs.curl
pkgs.fzf
pkgs.gawk
pkgs.gnugrep
pkgs.jq
@@ -74,23 +111,10 @@ pkgs.symlinkJoin {
pkgs.qrencode
pkgs.systemd
]
}" \
--set CLASH_API ${lib.escapeShellArg clashApi} \
--set SELECTION ${lib.escapeShellArg selection} \
--set SUB_TAGS_FILE ${lib.escapeShellArg (toString subscriptionTagsFile)} \
--set SUB_CACHE_DIR ${lib.escapeShellArg subscriptionCacheDir} \
--set PER_APP_ROUTING_ENABLED ${lib.escapeShellArg perAppRoutingEnabled} \
--set PER_APP_ROUTING_PROXYCHAINS_ENABLED ${lib.escapeShellArg perAppRoutingProxychainsEnabled} \
--set PER_APP_ROUTING_TUN_ENABLED ${lib.escapeShellArg perAppRoutingTunEnabled} \
--set PER_APP_ROUTING_TPROXY_ENABLED ${lib.escapeShellArg perAppRoutingTproxyEnabled} \
--set PER_APP_ROUTING_ZAPRET_ENABLED ${lib.escapeShellArg perAppRoutingZapretEnabled} \
--set PER_APP_ROUTING_PROFILES_FILE ${lib.escapeShellArg (toString perAppRoutingProfilesFile)} \
--set PROXYCHAINS_CONFIG ${lib.escapeShellArg (toString proxychainsConfigFile)} \
--set PROXYCHAINS_QUIET_ARG ${lib.escapeShellArg (lib.removeSuffix " " proxychainsQuietArg)} \
--set ROUTE_MODE_STATE_FILE ${lib.escapeShellArg routeModeStateFile} \
--set DEFAULT_ROUTE_MODE ${lib.escapeShellArg defaultRouteMode} \
--set AWG_PROFILES_FILE ${lib.escapeShellArg (toString amneziaWgProfileNamesFile)} \
--set INBOUNDS_ENABLED ${lib.escapeShellArg inboundsEnabled} \
--set INBOUNDS_LINKS_FILE ${lib.escapeShellArg inboundsLinksFile}
}" ${
lib.concatStringsSep " " (
lib.mapAttrsToList (name: value: "--set ${name} ${lib.escapeShellArg value}") wrapperEnv
)
}
'';
}