GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — module, esm: jsdoc for modules files · nodejs/node@9757989

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • dns
      • promises.js
    • modules
      • cjs
        • loader.js
      • esm
        • create_dynamic_module.js
        • fetch_module.js
        • handle_process_exit.js
        • loader.js
        • package_config.js
        • resolve.js
        • translators.js
        • utils.js
        • worker.js
      • helpers.js
      • run_main.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/dns/promises.js‎

Copy file name to clipboardExpand all lines: lib/internal/dns/promises.js
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ function onlookupall(err, addresses) {
113113
}
114114
}
115115

116+
/**
117+
* Creates a promise that resolves with the IP address of the given hostname.
118+
* @param {0 | 4 | 6} family - The IP address family (4 or 6, or 0 for both).
119+
* @param {string} hostname - The hostname to resolve.
120+
* @param {boolean} all - Whether to resolve with all IP addresses for the hostname.
121+
* @param {number} hints - One or more supported getaddrinfo flags (supply multiple via
122+
* bitwise OR).
123+
* @param {boolean} verbatim - Whether to use the hostname verbatim.
124+
* @returns {Promise<DNSLookupResult | DNSLookupResult[]>} The IP address(es) of the hostname.
125+
* @typedef {object} DNSLookupResult
126+
* @property {string} address - The IP address.
127+
* @property {0 | 4 | 6} family - The IP address type. 4 for IPv4 or 6 for IPv6, or 0 (for both).
128+
*/
116129
function createLookupPromise(family, hostname, all, hints, verbatim) {
117130
return new Promise((resolve, reject) => {
118131
if (!hostname) {
@@ -154,6 +167,17 @@ function createLookupPromise(family, hostname, all, hints, verbatim) {
154167
}
155168

156169
const validFamilies = [0, 4, 6];
170+
/**
171+
* Get the IP address for a given hostname.
172+
* @param {string} hostname - The hostname to resolve (ex. 'nodejs.org').
173+
* @param {object} [options] - Optional settings.
174+
* @param {boolean} [options.all=false] - Whether to return all or just the first resolved address.
175+
* @param {0 | 4 | 6} [options.family=0] - The record family. Must be 4, 6, or 0 (for both).
176+
* @param {number} [options.hints] - One or more supported getaddrinfo flags (supply multiple via
177+
* bitwise OR).
178+
* @param {boolean} [options.verbatim=false] - Return results in same order DNS resolved them;
179+
* otherwise IPv4 then IPv6. New code should supply `true`.
180+
*/
157181
function lookup(hostname, options) {
158182
let hints = 0;
159183
let family = 0;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.