provision: add route to detect ipv4 and ipv6
This commit is contained in:
@@ -9,6 +9,7 @@ exports = module.exports = {
|
||||
getStatus,
|
||||
setupTokenAuth,
|
||||
getBlockDevices,
|
||||
detectIP
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -16,6 +17,7 @@ const assert = require('assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
HttpSuccess = require('connect-lastmile').HttpSuccess,
|
||||
network = require('../network.js'),
|
||||
paths = require('../paths.js'),
|
||||
provision = require('../provision.js'),
|
||||
safe = require('safetydance'),
|
||||
@@ -149,3 +151,8 @@ async function getBlockDevices(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, { devices }));
|
||||
}
|
||||
|
||||
async function detectIP(req, res, next) {
|
||||
const result = await network.detectIP();
|
||||
next(new HttpSuccess(200, { ipv4: result.ipv4, ipv6: result.ipv6 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user