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

Function formatMulticastInterface

packages/effect/src/net/NetAddress.ts:2092–2105  ·  view source on GitHub ↗
(
  networkInterface: MulticastInterface,
  scopeIds: ReadonlyMap<string, number>,
  platform?: string
)

Source from the content-addressed store, hash-verified

2090 * @since 4.0.0
2091 */
2092export const formatMulticastInterface = (
2093 networkInterface: MulticastInterface,
2094 scopeIds: ReadonlyMap<string, number>,
2095 platform?: string
2096): string => {
2097 if (typeof networkInterface !== "number") return formatIp(networkInterface)
2098 if (networkInterface === 0) return "::"
2099 if (platform !== "win32") {
2100 for (const [name, scopeId] of scopeIds) {
2101 if (scopeId === networkInterface) return `::%${name}`
2102 }
2103 }
2104 return `::%${networkInterface}`
2105}
2106
2107/**
2108 * Formats a resolved internet address, bracketing IPv6 around its port.

Callers

nothing calls this directly

Calls 1

formatIpFunction · 0.85

Tested by

no test coverage detected