S
S
SpiritSound2015-11-22 20:07:04
JavaScript
SpiritSound, 2015-11-22 20:07:04

How to find hostname/hostname by user ip in node.js?

Hey!
There was a task to learn a name of a host on ip.
For example, we have ip: 178.66.32.125
Then for it the hostname will be: pppoe.178-66-32-125.dynamic.avangarddsl.ru
How to find hostname in node.js using http module?
I probably searched badly, but did not find the answer. I rummaged through the request object , there is nothing there either.
For example, in linux there is a command:
resolveip -s 178.66.32.125 - it will display hostname by ip address.
I would like to get advice or an answer for this task. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aves, 2015-11-22
@SpiritSound

https://nodejs.org/api/dns.html#dns_dns_reverse_ip...

$ node -e "require('dns').reverse('178.66.32.125', (err, hosts)=>console.log(hosts))"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question