mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-11-24 12:19:22 +01:00
myip.js: make everything functions
same issue with v6 :(
This commit is contained in:
parent
51f775913d
commit
a886bb4f73
@ -3,12 +3,14 @@
|
|||||||
// Require the dns module
|
// Require the dns module
|
||||||
var dns = require('dns');
|
var dns = require('dns');
|
||||||
|
|
||||||
// Set DNS servers to OpenDNS IPv4
|
// Function for IPv4
|
||||||
var servers4 = dns.setServers(["208.67.222.222", "208.67.220.220"])
|
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
|
// Check where myip.opendns.com resolves to and I think this is a
|
||||||
// that takes arguments err and addresses.
|
// function that takes arguments err and addresses.
|
||||||
dns.resolve4('myip.opendns.com', function (err, addresses) {
|
dns.resolve4('myip.opendns.com', function (err, addresses) {
|
||||||
|
|
||||||
// if err contains a truthy value, an error has occurred
|
// if err contains a truthy value, an error has occurred
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -17,23 +19,22 @@ dns.resolve4('myip.opendns.com', function (err, addresses) {
|
|||||||
// address.
|
// address.
|
||||||
console.log(addresses[0]);
|
console.log(addresses[0]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// This code makes node codedump for some reason, maybe it has a bug
|
// IPv6 part is broken because of node bug.
|
||||||
// with IPv6 handling or it doesn't like my system not having native
|
// https://github.com/nodejs/node/issues/894
|
||||||
// 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
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
// Function for IPv6
|
||||||
|
var myip6 = function () {
|
||||||
|
|
||||||
// Set DNS servers to OpenDNS IPv6
|
// Set DNS servers to OpenDNS IPv6
|
||||||
var servers6 = dns.setServers(["2620:0:ccc::2", "2620:0:ccd::2"])
|
var servers6 = dns.setServers(["2620:0:ccc::2", "2620:0:ccd::2"])
|
||||||
|
|
||||||
// Check where myip.opendns.com resolves to and I think this is a function
|
// Check where myip.opendns.com resolves to and I think this is a function
|
||||||
// that takes arguments err and addresses.
|
// that takes arguments err and addresses.
|
||||||
dns.resolve6('myip.opendns.com', function (err, addresses) {
|
dns.resolve6('myip.opendns.com', function (err, addresses) {
|
||||||
|
|
||||||
// if err contains a truthy value, an error has occurred
|
// if err contains a truthy value, an error has occurred
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -42,5 +43,10 @@ dns.resolve6('myip.opendns.com', function (err, addresses) {
|
|||||||
// address.
|
// address.
|
||||||
console.log(addresses[0]);
|
console.log(addresses[0]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Call the functions
|
||||||
|
myip4();
|
||||||
|
//myip6();
|
||||||
|
Loading…
Reference in New Issue
Block a user