Harden resolver and expand traffic runtime controls
This commit is contained in:
@@ -922,18 +922,65 @@ class DashboardController:
|
||||
|
||||
def domains_file_load(self, name: str) -> DomainsFile:
|
||||
nm = name.strip().lower()
|
||||
if nm not in ("bases", "meta", "subs", "static", "smartdns", "last-ips-map", "last-ips-map-direct", "last-ips-map-wildcard"):
|
||||
if nm not in (
|
||||
"bases",
|
||||
"meta",
|
||||
"subs",
|
||||
"static",
|
||||
"smartdns",
|
||||
"last-ips-map",
|
||||
"last-ips-map-direct",
|
||||
"last-ips-map-wildcard",
|
||||
"wildcard-observed-hosts",
|
||||
):
|
||||
raise ValueError(f"Invalid domains file name: {name}")
|
||||
return self.client.domains_file_get(
|
||||
cast(Literal["bases", "meta", "subs", "static", "smartdns", "last-ips-map", "last-ips-map-direct", "last-ips-map-wildcard"], nm)
|
||||
cast(
|
||||
Literal[
|
||||
"bases",
|
||||
"meta",
|
||||
"subs",
|
||||
"static",
|
||||
"smartdns",
|
||||
"last-ips-map",
|
||||
"last-ips-map-direct",
|
||||
"last-ips-map-wildcard",
|
||||
"wildcard-observed-hosts",
|
||||
],
|
||||
nm,
|
||||
)
|
||||
)
|
||||
|
||||
def domains_file_save(self, name: str, content: str) -> None:
|
||||
nm = name.strip().lower()
|
||||
if nm not in ("bases", "meta", "subs", "static", "smartdns", "last-ips-map", "last-ips-map-direct", "last-ips-map-wildcard"):
|
||||
if nm not in (
|
||||
"bases",
|
||||
"meta",
|
||||
"subs",
|
||||
"static",
|
||||
"smartdns",
|
||||
"last-ips-map",
|
||||
"last-ips-map-direct",
|
||||
"last-ips-map-wildcard",
|
||||
"wildcard-observed-hosts",
|
||||
):
|
||||
raise ValueError(f"Invalid domains file name: {name}")
|
||||
self.client.domains_file_set(
|
||||
cast(Literal["bases", "meta", "subs", "static", "smartdns", "last-ips-map", "last-ips-map-direct", "last-ips-map-wildcard"], nm), content
|
||||
cast(
|
||||
Literal[
|
||||
"bases",
|
||||
"meta",
|
||||
"subs",
|
||||
"static",
|
||||
"smartdns",
|
||||
"last-ips-map",
|
||||
"last-ips-map-direct",
|
||||
"last-ips-map-wildcard",
|
||||
"wildcard-observed-hosts",
|
||||
],
|
||||
nm,
|
||||
),
|
||||
content,
|
||||
)
|
||||
|
||||
# -------- Trace --------
|
||||
|
||||
Reference in New Issue
Block a user