MCPcopy Index your code
hub / github.com/masterking32/MasterHttpRelayVPN / load_host_rules

Function load_host_rules

src/proxy/proxy_support.py:77–89  ·  view source on GitHub ↗

Accept a list of host strings; return (exact_set, suffix_tuple).

(raw)

Source from the content-addressed store, hash-verified

75
76
77def load_host_rules(raw) -> tuple[set[str], tuple[str, ...]]:
78 """Accept a list of host strings; return (exact_set, suffix_tuple)."""
79 exact: set[str] = set()
80 suffixes: list[str] = []
81 for item in raw or []:
82 host = str(item).strip().lower().rstrip(".")
83 if not host:
84 continue
85 if host.startswith("."):
86 suffixes.append(host)
87 else:
88 exact.add(host)
89 return exact, tuple(suffixes)
90
91
92def host_matches_rules(host: str, rules: tuple[set[str], tuple[str, ...]]) -> bool:

Callers 3

__init__Method · 0.85
_updateMethod · 0.85

Calls

no outgoing calls