edgeport - v1.0.6
    Preparing search index...

    Function connect

    • Connects to a DNS resolver over TCP (or TLS) and returns a reusable session.

      The session pipelines queries over one connection, correlating responses by id. Remember the Cloudflare-IP block: inside a Worker, pass a non-Cloudflare hostname (e.g. RESOLVERS.google) because the default 1.1.1.1 is unreachable from the Workers runtime.

      Parameters

      • opts: DnsConnectOptions = {}

        Connection options (resolver host/port, TLS, timeout).

      Returns Promise<DnsSession>

      The live session.

      If the connection cannot be established.

      If an unsupported transport is requested.

      1.0.4

      import { connect, RESOLVERS } from 'edgeport/dns';

      await using dns = await connect({ hostname: RESOLVERS.google });
      const ips = await dns.query('example.com', 'A');
      const mx = await dns.query('example.com', 'MX');