MCPcopy Index your code
hub / github.com/stemdeckapp/stemdeck / _is_loopback

Function _is_loopback

app/main.py:303–308  ·  view source on GitHub ↗
(host: str | None)

Source from the content-addressed store, hash-verified

301
302
303def _is_loopback(host: str | None) -> bool:
304 if not host:
305 return False
306 if host.startswith("::ffff:"): # IPv4-mapped IPv6
307 host = host[7:]
308 return host in {"127.0.0.1", "::1", "localhost"} or host.startswith("127.")
309
310
311@functools.lru_cache(maxsize=1)

Callers 3

test_is_loopbackFunction · 0.90
_is_lan_ipv4Function · 0.85
_is_host_requestFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_is_loopbackFunction · 0.72