MCPcopy Create free account
hub / github.com/Effect-TS/effect / formatNativeHost

Function formatNativeHost

packages/effect/src/net/NetAddress.ts:2061–2072  ·  view source on GitHub ↗
(
  self: InetAddress,
  scopeIds: ReadonlyMap<string, number>,
  platform?: string
)

Source from the content-addressed store, hash-verified

2059 * @since 4.0.0
2060 */
2061export const formatNativeHost = (
2062 self: InetAddress,
2063 scopeIds: ReadonlyMap<string, number>,
2064 platform?: string
2065): string => {
2066 if (platform !== "win32" && isInetAddressV6(self) && self.scopeId !== 0) {
2067 for (const [name, scopeId] of scopeIds) {
2068 if (scopeId === self.scopeId) return `${formatIp(self.address)}%${name}`
2069 }
2070 }
2071 return formatHost(self)
2072}
2073
2074/**
2075 * Formats an IPv4 address or IPv6 interface index for a native multicast API.

Callers

nothing calls this directly

Calls 3

isInetAddressV6Function · 0.85
formatIpFunction · 0.85
formatHostFunction · 0.70

Tested by

no test coverage detected