fold sysinfo into network
the backends are network backends
This commit is contained in:
+18
-1
@@ -14,7 +14,10 @@ exports = module.exports = {
|
||||
setIPv4Config,
|
||||
|
||||
getIPv6Config,
|
||||
setIPv6Config
|
||||
setIPv6Config,
|
||||
|
||||
getIPv4,
|
||||
getIPv6,
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -117,3 +120,17 @@ async function setIPv6Config(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function getIPv4(req, res, next) {
|
||||
const [error, ipv4] = await safe(network.getIPv4());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { ipv4 }));
|
||||
}
|
||||
|
||||
async function getIPv6(req, res, next) {
|
||||
const [error, ipv6] = await safe(network.getIPv6()); // ignore any error
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { ipv6 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user