mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-11-28 06:09:23 +01:00
myip.js: make everything functions
same issue with v6 :(
This commit is contained in:
parent
51f775913d
commit
a886bb4f73
@ -3,11 +3,13 @@
|
||||
// Require the dns module
|
||||
var dns = require('dns');
|
||||
|
||||
// Function for IPv4
|
||||
var myip4 = function () {
|
||||
// Set DNS servers to OpenDNS IPv4
|
||||
var servers4 = dns.setServers(["208.67.222.222", "208.67.220.220"])
|
||||
|
||||
// Check where myip.opendns.com resolves to and I think this is a function
|
||||
// that takes arguments err and addresses.
|
||||
// Check where myip.opendns.com resolves to and I think this is a
|
||||
// function that takes arguments err and addresses.
|
||||
dns.resolve4('myip.opendns.com', function (err, addresses) {
|
||||
|
||||
// if err contains a truthy value, an error has occurred
|
||||
@ -18,15 +20,14 @@ dns.resolve4('myip.opendns.com', function (err, addresses) {
|
||||
console.log(addresses[0]);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// This code makes node codedump for some reason, maybe it has a bug
|
||||
// with IPv6 handling or it doesn't like my system not having native
|
||||
// or not-Teredo IPv6 connectivity.
|
||||
|
||||
// node: ../deps/cares/src/ares_destroy.c:102: ares__destroy_servers_state: Assertion `ares__is_list_empty(&server->queries_to_server)' failed.
|
||||
// zsh: abort (core dumped) ./myip.js
|
||||
// IPv6 part is broken because of node bug.
|
||||
// https://github.com/nodejs/node/issues/894
|
||||
|
||||
/*
|
||||
// Function for IPv6
|
||||
var myip6 = function () {
|
||||
|
||||
// Set DNS servers to OpenDNS IPv6
|
||||
var servers6 = dns.setServers(["2620:0:ccc::2", "2620:0:ccd::2"])
|
||||
@ -43,4 +44,9 @@ dns.resolve6('myip.opendns.com', function (err, addresses) {
|
||||
console.log(addresses[0]);
|
||||
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
// Call the functions
|
||||
myip4();
|
||||
//myip6();
|
||||
|
Loading…
Reference in New Issue
Block a user