Fetches from addresses that other people's input names, such as the icon links on a site's home page or a link domain, and only from the public internet (the SDK's safefetch.ts). Only https is fetched, never a private, loopback, link-local, or metadata address, and redirects are followed by hand under the same rules.
The default fetcher (Runlight.Fetch.httpc/2) resolves the name itself,
checks every address, and connects to one it checked, so a name that
answers differently a moment later gets nowhere. The name is also checked
just before each request, for a fetcher of the app's own that cannot
choose the address it connects to.
Summary
Functions
Whether an IP address, v4 or v6, is on the public internet. Anything that is not an address is not.
The public addresses a name resolves to, for setting up DNS records. None where it does not resolve.
Fetches an https URL on the public internet (a GET unless method: and
body: say otherwise), following up to redirects: redirects that stay
on it, within timeout: milliseconds in all. Only a GET follows
redirects; anything else comes back with the redirect as it is. Answers
{:error, :private} for an address off it and {:error, :timeout} when
time runs out. A redirect past the last one comes back as it is.
Whether a name resolves to an address off the public internet. False when it does not resolve.
Functions
Whether an IP address, v4 or v6, is on the public internet. Anything that is not an address is not.
The public addresses a name resolves to, for setting up DNS records. None where it does not resolve.
@spec public_fetch(Runlight.t(), String.t(), keyword()) :: {:ok, Runlight.Http.Response.t()} | {:error, term()}
Fetches an https URL on the public internet (a GET unless method: and
body: say otherwise), following up to redirects: redirects that stay
on it, within timeout: milliseconds in all. Only a GET follows
redirects; anything else comes back with the redirect as it is. Answers
{:error, :private} for an address off it and {:error, :timeout} when
time runs out. A redirect past the last one comes back as it is.
Whether a name resolves to an address off the public internet. False when it does not resolve.