Function reverse

  • Resolve an IP to Hosts

    Parameters

    • ip: IPAddress<4 | 6>
    • mode: "dns" | "fetch" = 'fetch'

    Returns Promise<string | null>

    Example

    import { dns, network } from "@rjweb/utils"

    const [ googleV4, googleV6 ] = await Promise.all([
    dns.resolve('google.com', 'v4'),
    dns.resolve('google.com', 'v6')
    ])

    await dns.reverse(new network.IPAddress('1.1.1.1')) // null
    await dns.reverse(googleV4) // 'fra16s53-in-f14.1e100.net'
    await dns.reverse(googleV6) // 'fra16s53-in-x0e.1e100.net'

    Since

    1.10.5

    Supports

    nodejs, browser

    Default

    mode = 'fetch'