MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / isLoopbackHost

Function isLoopbackHost

graph-ui/tools/net-deny-gate.mjs:45–52  ·  view source on GitHub ↗
(host)

Source from the content-addressed store, hash-verified

43
44/** 127.0.0.0/8, ::1 und ihre Schreibweisen. Nur diese gelten als lokal. */
45export function isLoopbackHost(host) {
46 if (host === undefined || host === null) { return false; }
47 let h = host.trim();
48 if (h.startsWith('[') && h.endsWith(']')) { h = h.slice(1, -1); }
49 if (h === 'localhost' || h === '::1' || h === '0:0:0:0:0:0:0:1') { return true; }
50 const v4 = h.startsWith('::ffff:') ? h.slice(7) : h;
51 return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v4);
52}
53
54/** Trennt "127.0.0.1:52000" oder "[::1]:52000" in Host und Port. */
55export function splitHostPort(endpoint) {

Callers 2

classifyLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected