var path = require('path');
var fs = require('fs');
var assert = require('assert');
+var os = require('os');
exports.testDir = path.dirname(__filename);
exports.fixturesDir = path.join(exports.testDir, 'fixtures');
"faketime");
}
+var ifaces = os.networkInterfaces();
+exports.hasIPv6 = Object.keys(ifaces).some(function(name) {
+ return /lo/.test(name) && ifaces[name].some(function(info) {
+ return info.family === 'IPv6';
+ });
+});
+
var util = require('util');
for (var i in util) exports[i] = util[i];
//for (var i in exports) global[i] = exports[i];
this.close();
}));
+if (!common.hasIPv6) {
+ console.error('Skipping udp6 part of test, no IPv6 support');
+ return;
+}
+
dgram.createSocket('udp6').bind(common.PORT + 1, common.mustCall(function() {
assert.equal(this.address().port, common.PORT + 1);
var address = this.address().address;
var net = require('net');
var dns = require('dns');
+if (!common.hasIPv6) {
+ console.error('Skipping test, no IPv6 support');
+ return;
+}
+
var serverGotEnd = false;
var clientGotEnd = false;
pingPongTest(common.PIPE);
pingPongTest(common.PORT);
pingPongTest(common.PORT + 1, 'localhost');
-pingPongTest(common.PORT + 2, '::1');
+if (common.hasIPv6)
+ pingPongTest(common.PORT + 2, '::1');
process.on('exit', function() {
- assert.equal(4, tests_run);
+ if (common.hasIPv6)
+ assert.equal(4, tests_run);
+ else
+ assert.equal(3, tests_run);
console.log('done');
});
server_ipv6.close();
});
+if (!common.hasIPv6) {
+ console.error('Skipping ipv6 part of test, no IPv6 support');
+ return;
+}
+
// Test without hostname or ip
var anycast_ipv6 = '::';
var server1 = net.createServer();