fix: various fixes
This commit is contained in:
18 files changed
+471
-88
No files matched your search
@@ -2144,7 +2144,12 @@ def _where_inbounds(config, domain, geosite_dir):
|
||||
and _where_rule_set_match({"path": os.path.join(geosite_dir, f"geosite-{value}.srs"), "format": "binary"}, domain))
|
||||
)
|
||||
if matched:
|
||||
return _s(rule.get("outboundTag")), f"{_s(rule.get('ruleTag'))} ({entry})"
|
||||
# A rule held to some listeners or ports says so: the rest go on down the list.
|
||||
scope = "".join(
|
||||
[f", listeners {','.join(map(_s, rule['inboundTag']))}" if rule.get("inboundTag") else ""]
|
||||
+ [f", ports {_s(rule['port'])}" if rule.get("port") else ""]
|
||||
)
|
||||
return _s(rule.get("outboundTag")), f"{_s(rule.get('ruleTag'))} ({entry}{scope})"
|
||||
return "", ""
|
||||
|
||||
|
||||
|
||||
@@ -690,6 +690,11 @@ class WhereTest(EnvTest):
|
||||
self.assertEqual(ctl._where_inbounds(config, "rr1.googlevideo.com", "")[0], "proxy")
|
||||
self.assertEqual(ctl._where_inbounds(config, "youtube.com", ""), ("direct", "inbound-zapret-direct-domain (full:youtube.com)"))
|
||||
self.assertEqual(ctl._where_inbounds(config, "example.org", "")[0], "proxy")
|
||||
config["routing"]["rules"][2] |= {"inboundTag": ["relay"], "port": "443"}
|
||||
self.assertEqual(
|
||||
ctl._where_inbounds(config, "youtube.com", "")[1],
|
||||
"inbound-zapret-direct-domain (full:youtube.com, listeners relay, ports 443)",
|
||||
)
|
||||
|
||||
|
||||
class StatusSnapshotTest(EnvTest):
|
||||
|
||||
Reference in new issue
Block a user