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

Function lookup

packages/platform/node-shared/src/NodeDns.ts:369–378  ·  view source on GitHub ↗
(
  host: string,
  family?: NetAddress.IpFamily | undefined
)

Source from the content-addressed store, hash-verified

367 * @since 4.0.0
368 */
369export const lookup = (
370 host: string,
371 family?: NetAddress.IpFamily | undefined
372): Effect.Effect<Array<NetAddress.IpAddress>, Dns.DnsError> =>
373 Effect.tryPromise({
374 // `verbatim` keeps the system order on Node versions without `order`.
375 try: () =>
376 NodeDns.promises.lookup(host, { all: true, family: toFamily(family), order: "verbatim", verbatim: true }),
377 catch: (cause) => dnsErrorFromCause(cause, "lookup", host)
378 }).pipe(Effect.map(addressesFromLookup))
379
380// Clamp resolver options to positive signed 32-bit integers; NaN becomes 1.
381const resolverInt = (value: number): number => value >= 1 ? Math.min(value, 2 ** 31 - 1) : 1

Callers

nothing calls this directly

Calls 4

toFamilyFunction · 0.85
dnsErrorFromCauseFunction · 0.85
pipeMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected