Closed davistran86 closed 1 year ago
I don't know why but importing node:dns make this works:
import * as dns from "dns";
import pingus from "pingus";
const ping = new pingus.PingICMP({
host: "my.myserver.abc.local",
ttl: 128,
bytes: 32,
dnsServer: "192.168.30.222",
resolveDNS: true,
}) as any;
ping.on("ready", (result) => {
console.log("ping\ttarget:\t", result.host);
console.log("\tips:\t", result.ips);
});
ping.send();
Sorry. I can't reproduce error like you. I don't have an internal dns server. So I tested some of known dns servers(1.1.1.1, 8.8.8.8, 8.26.56.26, 64.6.64.6
). but it worked (all dns servers send me an different ips).
import pingus from 'pingus';
const ping = new pingus.PingICMP({
host: 'google.com',
ttl: 128,
bytes: 32,
dnsServer: '1.1.1.1', // change to 8.8.8.8, 8.26.56.26, 64.6.64.6
resolveDNS: true,
});
ping.on('result', (result) => {
console.log('ping\ttarget:\t', result.host);
console.log('\tips:\t', result.ips);
});
ping.send();
Additionally README has an error. you need to fix ping.on("ready" ...
to ping.on("result" ...
Hi author, thanks for this awesome package. Can you please help on issue with ENOTFOUND when using with my internal hostname ? I have already specified a dns server but it's not working. I'm sure the hostname is resolved in terminal. my code: