Skip to content

Lookup the fully qualified domain name ("FQDN") of the current server's IP (default) or a custom IP. 90x faster than `hostname -f` and works with Node v6.4+.

License

Notifications You must be signed in to change notification settings

forwardemail/get-fqdn

Repository files navigation

get-fqdn

build status code style styled with prettier made with lass license npm downloads

Lookup the fully qualified domain name ("FQDN") of the current server's IP (default) or a custom IP. 90x faster than hostname -f and works with Node v14+.

Table of Contents

Install

npm:

npm install get-fqdn

Usage

const getFQDN = require('get-fqdn');

// async/await usage
(async () => {
  try {
    const fqdn = await getFQDN();
    console.log('fqdn', fqdn);
  } catch (err) {
    console.error(err);
  }
});

// then/catch usage
getFQDN().then(fqdn => console.log('fqdn', fqdn)).catch(console.error);

Note that you can also pass a custom IP:

const fqdn = await getFQDN('1.1.1.1');
console.log('fqdn', fqdn);

Performance

This package runs approximately 90x faster than the alternative of using hostname -f.

It was built to ensure that ForwardEmail.net is as optimized as possible.

Others packages were written in CoffeeScript, used deasync, or used the hostname -f approach (also see the fqdn package that uses the wrong approach too).

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

About

Lookup the fully qualified domain name ("FQDN") of the current server's IP (default) or a custom IP. 90x faster than `hostname -f` and works with Node v6.4+.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published