Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

BunDns

Bun implementation of Effect's Dns service.

Address lookups use Bun.dns.lookup with the system backend, which calls the operating system resolver (getaddrinfo) and therefore also reads the hosts file. Bun's node:dns lookup uses c-ares instead, which bypasses the system's name service configuration. Record queries and reverse lookups use NodeDns.resolver without the UTF-8 correction of NodeDns.make, because Bun already decodes TXT and CAA character strings as UTF-8.

Gotchas

Bun returns each character string of a TXT record as a separate record, so a record made of several strings arrives as several TXT records whose chunks cannot be reassembled (https://github.com/oven-sh/bun/issues/44692).

Bun's resolver cannot query TLSA records, so TLSA queries fail with Unsupported.

4 exports Since v4.0.0 Source

Constructors

Since v4.0.0

Creates a Bun Dns service whose resolver lives as long as the scope.

Signature

declare const make: (...args: [options?: any]) => Effect<any, unknown, unknown>

Layers

Since v4.0.0

Layer that provides the Bun Dns service using the system resolver configuration.

Signature

declare const layer: Layer.Layer<Dns.Dns>

Creates a layer that provides the Bun Dns service with options read from configuration.

Signature

declare function layerConfig(options: Config<Options>): Layer<Dns, ConfigError | NetAddressError>

Other

Signature

type Options = any