@@ -13,7 +13,7 @@ const assert = require('assert'),
|
||||
async function getServerIPv4(config) {
|
||||
assert.strictEqual(typeof config, 'object');
|
||||
|
||||
return config.ip;
|
||||
return config.ipv4;
|
||||
}
|
||||
|
||||
async function getServerIPv6(config) {
|
||||
@@ -27,12 +27,12 @@ async function getServerIPv6(config) {
|
||||
async function testConfig(config) {
|
||||
assert.strictEqual(typeof config, 'object');
|
||||
|
||||
if (typeof config.ip !== 'string') return new BoxError(BoxError.BAD_FIELD, 'ipv4 must be a string');
|
||||
if (!net.isIPv4(config.ip)) return new BoxError(BoxError.BAD_FIELD, 'ip is not a valid ipv4');
|
||||
if (typeof config.ipv4 !== 'string') return new BoxError(BoxError.BAD_FIELD, 'ipv4 must be a string');
|
||||
if (!net.isIPv4(config.ipv4)) return new BoxError(BoxError.BAD_FIELD, 'invalid IPv4');
|
||||
|
||||
if ('ipv6' in config) {
|
||||
if (typeof config.ipv6 !== 'string') return new BoxError(BoxError.BAD_FIELD, 'ipv6 must be a string');
|
||||
if (!net.isIPv6(config.ipv6)) return new BoxError(BoxError.BAD_FIELD, 'ipv6 is not a valid ipv6');
|
||||
if (!net.isIPv6(config.ipv6)) return new BoxError(BoxError.BAD_FIELD, 'invalid IPv6');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user