network: simply use ip instead of ipv4/ipv6

this makes it simpler for openapi docs
This commit is contained in:
Girish Ramakrishnan
2023-09-12 20:13:27 +05:30
parent 58bf5ec677
commit 964dc990a6
4 changed files with 38 additions and 16 deletions
+4 -4
View File
@@ -101,15 +101,15 @@ async function setIPv6Config(req, res, next) {
}
async function getIPv4(req, res, next) {
const [error, ipv4] = await safe(network.getIPv4());
const [error, ip] = await safe(network.getIPv4());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { ipv4 }));
next(new HttpSuccess(200, { ip }));
}
async function getIPv6(req, res, next) {
const [error, ipv6] = await safe(network.getIPv6()); // ignore any error
const [error, ip] = await safe(network.getIPv6()); // ignore any error
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { ipv6 }));
next(new HttpSuccess(200, { ip }));
}