MCPcopy
hub / github.com/coder/mux / isLoopbackAddress

Function isLoopbackAddress

src/node/utils/oauthLoopbackServer.ts:78–87  ·  view source on GitHub ↗

* Check whether an address string is a loopback address. * Node may normalize IPv4 loopback to an IPv6-mapped address. * * Extracted from codexOauthService.ts where validateLoopback is used.

(address: string | undefined)

Source from the content-addressed store, hash-verified

76 * Extracted from codexOauthService.ts where validateLoopback is used.
77 */
78function isLoopbackAddress(address: string | undefined): boolean {
79 if (!address) return false;
80
81 // Node may normalize IPv4 loopback to an IPv6-mapped address.
82 if (address === "::ffff:127.0.0.1") {
83 return true;
84 }
85
86 return address === "127.0.0.1" || address === "::1";
87}
88
89/**
90 * Format a `server.listen()` host value for use inside a URL.

Callers 1

startLoopbackServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected