fold sysinfo into network

the backends are network backends
This commit is contained in:
Girish Ramakrishnan
2023-08-03 13:38:42 +05:30
parent a4d57e7b08
commit 47d57a3971
23 changed files with 143 additions and 161 deletions
+18 -1
View File
@@ -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 }));
}