https://github.com/forwardemail/get-fqdn
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+.
https://github.com/forwardemail/get-fqdn
address dns domain fetch fqdn fully hostname ip javascript lookup name node qualified
Last synced: 6 months ago
JSON representation
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+.
- Host: GitHub
- URL: https://github.com/forwardemail/get-fqdn
- Owner: forwardemail
- License: mit
- Created: 2019-05-08T21:46:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-13T08:42:38.000Z (almost 3 years ago)
- Last Synced: 2025-04-20T16:12:28.498Z (6 months ago)
- Topics: address, dns, domain, fetch, fqdn, fully, hostname, ip, javascript, lookup, name, node, qualified
- Language: JavaScript
- Size: 140 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# get-fqdn
[](https://github.com/forwardemail/get-fqdn/actions/workflows/ci.yml)
[](https://github.com/sindresorhus/xo)
[](https://github.com/prettier/prettier)
[](https://lass.js.org)
[](LICENSE)
[](https://npm.im/get-fqdn)> 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](#install)
* [Usage](#usage)
* [Performance](#performance)
* [Contributors](#contributors)
* [License](#license)## Install
[npm][]:
```sh
npm install get-fqdn
```## Usage
```js
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:
```js
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](https://forwardemail.net) is as optimized as possible.
Others packages [were written in CoffeeScript](https://github.com/CliffS/fqdn-promise/blob/master/src/fqdn.coffee), used [deasync](https://github.com/rsrdesarrollo/node-fqdn/blob/master/index.js), or used the [hostname -f](https://github.com/fatelei/js-fqdn/blob/ffec496afb07559fb64dc5e6b78b50c6339d78c5/lib/fqdn.js) approach (also see the [fqdn][] package that uses the wrong approach too).
## Contributors
| Name | Website |
| -------------- | -------------------------- |
| **Nick Baugh** | |## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[fqdn]: https://www.npmjs.com/package/fqdn