small fixes

This commit is contained in:
FUFSoB committed 2026-04-22 16:02:31 +05:00
1 parent 65e815e6dc
commit b696821d8c
5 files changed
+38 -44

No files matched your search

+6 -10
View File
@@ -154,19 +154,15 @@ let
r.proxy.geoips ++ direct.geoips ++ r.block.geoips ++ lib.concatMap (rule: rule.geoips) customRules
);
geositeRuleSets = map (name: {
tag = "geosite-${name}";
mkRuleSet = kind: pkg: name: {
tag = "${kind}-${name}";
type = "local";
format = "binary";
path = "${pkgs.sing-geosite}/share/sing-box/rule-set/geosite-${name}.srs";
}) allGeositeNames;
path = "${pkg}/share/sing-box/rule-set/${kind}-${name}.srs";
};
geoIPRuleSets = map (name: {
tag = "geoip-${name}";
type = "local";
format = "binary";
path = "${pkgs.sing-geoip}/share/sing-box/rule-set/geoip-${name}.srs";
}) allGeoIPNames;
geositeRuleSets = map (mkRuleSet "geosite" pkgs.sing-geosite) allGeositeNames;
geoIPRuleSets = map (mkRuleSet "geoip" pkgs.sing-geoip) allGeoIPNames;
routingRules = lib.flatten [
{
+10 -20
View File
@@ -197,6 +197,11 @@ let
}
];
perAppZapretDesyncMarks = [
67108864
134217728
];
forbiddenValueAssertions =
map (item: forbiddenValues item.condition item.value item.disallowed item.message)
[
@@ -212,46 +217,31 @@ let
{
condition = perAppZapretCfg.enable;
value = globalTproxy.fwmark;
disallowed = [
67108864
134217728
];
disallowed = perAppZapretDesyncMarks;
message = "proxy-suite: singBox.tproxy.fwmark must not use per-app-zapret internal desync mark bits";
}
{
condition = perAppZapretCfg.enable;
value = globalTproxy.proxyMark;
disallowed = [
67108864
134217728
];
disallowed = perAppZapretDesyncMarks;
message = "proxy-suite: singBox.tproxy.proxyMark must not use per-app-zapret internal desync mark bits";
}
{
condition = perAppRoutingTun.enable && perAppZapretCfg.enable;
value = perAppRoutingTun.fwmark;
disallowed = [
67108864
134217728
];
disallowed = perAppZapretDesyncMarks;
message = "proxy-suite: singBox.tun.perApp.fwmark must not use per-app-zapret internal desync mark bits";
}
{
condition = perAppRoutingTproxy.enable && perAppZapretCfg.enable;
value = perAppRoutingTproxy.fwmark;
disallowed = [
67108864
134217728
];
disallowed = perAppZapretDesyncMarks;
message = "proxy-suite: singBox.tproxy.perApp.fwmark must not use per-app-zapret internal desync mark bits";
}
{
condition = perAppZapretCfg.enable;
value = perAppZapretCfg.filterMark;
disallowed = [
67108864
134217728
];
disallowed = perAppZapretDesyncMarks;
message = "proxy-suite: zapret.perApp.filterMark must not use per-app-zapret internal desync mark bits";
}
];
+5 -3
View File
@@ -10,16 +10,18 @@ let
t = cfg.tgWsProxy;
tgPkg = packages.tg-ws-proxy;
dcArgs = lib.concatMapStrings (id: " --dc-ip=${id}:${t.dcIps.${id}}") (builtins.attrNames t.dcIps);
dcArgs = lib.concatMapStrings
(id: " --dc-ip=${lib.escapeShellArg "${id}:${t.dcIps.${id}}"}")
(builtins.attrNames t.dcIps);
startScript = pkgs.writeShellScript "proxy-suite-tg-ws-proxy-start" ''
exec ${tgPkg}/bin/tg-ws-proxy \
--port=${toString t.port} \
--host=${t.host} \
--host=${lib.escapeShellArg t.host} \
${
if t.secretFile != null then
"--secret-file=$CREDENTIALS_DIRECTORY/tg_ws_proxy_secret"
else
"--secret=${t.secret}"
"--secret=${lib.escapeShellArg t.secret}"
}${dcArgs}
'';
in
+12 -9
View File
@@ -56,14 +56,17 @@ _svc_active() {
}
_status_tray() {
printf 'socks_available=%s\n' "$(_bool _svc_exists proxy-suite-socks)"
printf 'socks_active=%s\n' "$(_bool _svc_active proxy-suite-socks)"
printf 'tproxy_available=%s\n' "$(_bool _svc_exists proxy-suite-tproxy)"
printf 'tproxy_active=%s\n' "$(_bool _svc_active proxy-suite-tproxy)"
printf 'tun_available=%s\n' "$(_bool _svc_exists proxy-suite-tun)"
printf 'tun_active=%s\n' "$(_bool _svc_active proxy-suite-tun)"
printf 'zapret_available=%s\n' "$(_bool _svc_exists zapret-discord-youtube)"
printf 'zapret_active=%s\n' "$(_bool _svc_active zapret-discord-youtube)"
local pair key svc
for pair in \
socks:proxy-suite-socks \
tproxy:proxy-suite-tproxy \
tun:proxy-suite-tun \
zapret:zapret-discord-youtube; do
key="${pair%%:*}"
svc="${pair##*:}"
printf '%s_available=%s\n' "$key" "$(_bool _svc_exists "$svc")"
printf '%s_active=%s\n' "$key" "$(_bool _svc_active "$svc")"
done
printf 'subscription_update_available=%s\n' "$(_bool _svc_exists proxy-suite-subscription-update)"
}
@@ -248,7 +251,7 @@ cmd_apps() {
cmd_wrap() {
local route
profile="${1:?Usage: proxy-ctl wrap <profile> -- <command> [args...]}"
local profile="${1:?Usage: proxy-ctl wrap <profile> -- <command> [args...]}"
shift || true
if [ "${1:-}" = "--" ]; then
shift
+5 -2
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import base64
import binascii
import json
import urllib.parse
@@ -18,6 +19,8 @@ def _parse_url_parts(url: str, scheme: str) -> tuple[str, str, str, dict]:
userinfo = ""
hostpart, _, query = rest.partition("?")
host, _, port = hostpart.rpartition(":")
if host.startswith("[") and host.endswith("]"):
host = host[1:-1]
return userinfo, host, port, _qs(query)
@@ -112,7 +115,7 @@ def parse_vmess(url: str, tag: str) -> dict:
pad = "=" * (-len(b64) % 4)
try:
data = json.loads(base64.b64decode(b64 + pad))
except Exception:
except (binascii.Error, ValueError):
data = json.loads(base64.urlsafe_b64decode(b64 + pad))
host = str(data["add"])
@@ -189,7 +192,7 @@ def parse_shadowsocks(url: str, tag: str) -> dict:
if ":" not in decoded:
raise ValueError
method, password = decoded.split(":", 1)
except Exception:
except (binascii.Error, UnicodeDecodeError, ValueError):
plain = urllib.parse.unquote(userinfo)
method, password = plain.split(":", 1)