sysinfo: getIp -> getPublicIp

This commit is contained in:
Girish Ramakrishnan
2017-02-23 22:03:44 -08:00
parent fdb8139b03
commit 32e2377828
9 changed files with 21 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getIp: getIp
getPublicIp: getPublicIp
};
var assert = require('assert'),
@@ -9,7 +9,7 @@ var assert = require('assert'),
safe = require('safetydance'),
SysInfoError = require('../sysinfo.js').SysInfoError;
function getIp(callback) {
function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
if (process.env.BOX_ENV === 'test') return callback(null, '127.0.0.1');

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getIp: getIp
getPublicIp: getPublicIp
};
var assert = require('assert'),
@@ -9,7 +9,7 @@ var assert = require('assert'),
SysInfoError = require('../sysinfo.js').SysInfoError,
util = require('util');
function getIp(callback) {
function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
superagent.get('http://169.254.169.254/latest/meta-data/public-ipv4').timeout(30 * 1000).end(function (error, result) {

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getIp: getIp
getPublicIp: getPublicIp
};
var assert = require('assert'),
@@ -10,7 +10,7 @@ var assert = require('assert'),
superagent = require('superagent'),
SysInfoError = require('../sysinfo.js').SysInfoError;
function getIp(callback) {
function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
async.retry({ times: 10, interval: 5000 }, function (callback) {

View File

@@ -7,12 +7,12 @@
// -------------------------------------------
exports = module.exports = {
getIp: getIp
getPublicIp: getPublicIp
};
var assert = require('assert');
function getIp(callback) {
function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
callback(new Error('not implemented'));

View File

@@ -1,13 +1,13 @@
'use strict';
exports = module.exports = {
getIp: getIp
getPublicIp: getPublicIp
};
var assert = require('assert'),
superagent = require('superagent');
function getIp(callback) {
function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
superagent.get('http://169.254.42.42/conf').timeout(30 * 1000).end(function (error, result) {