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

Function inetAddressV4

packages/effect/src/net/NetAddress.ts:1627–1635  ·  view source on GitHub ↗
(address: Ipv4Address, port: number)

Source from the content-addressed store, hash-verified

1625 * @since 4.0.0
1626 */
1627export const inetAddressV4 = (address: Ipv4Address, port: number): Result.Result<InetAddressV4, NetAddressError> => {
1628 if (!checkPort(port)) {
1629 return addressError(address, "port must be an integer from 0 through 65535")
1630 }
1631 const self = Object.create(InetV4Proto)
1632 self.address = address
1633 self.port = port
1634 return Result.succeed(Object.freeze(self))
1635}
1636
1637/**
1638 * Creates a checked IPv6 internet address with an optional scope identifier.

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