简体   繁体   中英

How to check a change of dns server in nodejs


I will need some help on on the topic.

I want to create a script to check when a dns is changed ,
when a user switches network providers.

I tried running
dns.getServers() in the node cli
it returned the dns of the present network

I made a switch to another network provider without exiting the node cli
executed dns.getServers() again
it return the dns of the previous provider

How can one fix this.

I found a solution to the problem. Thanks to @jfriend00 for the native code issue.

the best way for now to get node to detect you dns when a change occur is to get a dependence resolvmon

npm install resolvmon

it work like a charm.

but if anyone still have a better approach, i will like to know and learn.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM