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

Function inetAddressV6

packages/effect/src/net/NetAddress.ts:1644–1661  ·  view source on GitHub ↗
(
  address: Ipv6Address,
  port: number,
  options?: { readonly scopeId?: number | undefined }
)

Source from the content-addressed store, hash-verified

1642 * @since 4.0.0
1643 */
1644export const inetAddressV6 = (
1645 address: Ipv6Address,
1646 port: number,
1647 options?: { readonly scopeId?: number | undefined }
1648): Result.Result<InetAddressV6, NetAddressError> => {
1649 if (!checkPort(port)) {
1650 return addressError(address, "port must be an integer from 0 through 65535")
1651 }
1652 const scopeId = options?.scopeId ?? 0
1653 if (!Number.isInteger(scopeId) || scopeId < 0 || scopeId > 0xffffffff) {
1654 return addressError(address, "scopeId must be an unsigned 32-bit integer")
1655 }
1656 const self = Object.create(InetV6Proto)
1657 self.address = address
1658 self.port = port
1659 self.scopeId = scopeId
1660 return Result.succeed(Object.freeze(self))
1661}
1662
1663/**
1664 * Creates a checked internet address for an IP address and port.

Callers 3

inetAddressFunction · 0.85
inetAddressFromStringFunction · 0.85
inetAddressFromInputFunction · 0.85

Calls 3

checkPortFunction · 0.85
addressErrorFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected