function resolvePublicAddress
resolvePublicAddress(url: URL): Promise<string>

Resolves the host of url and returns one of its addresses, all of which must be public: the fetch may pick any of them. fetchWithTimeout calls it before each hop.

Only the curl fallback connects to the address returned. Deno's fetch resolves the name again, so a DNS server that answers differently the second time (rebinding) can still get through.

Parameters

url: URL

Return Type

Promise<string>

Throws

Error

When the host is private, can't be resolved, or resolves to a private address.

Usage

import { resolvePublicAddress } from "api/remote/public-address.ts";