make ipv4 and ipv6 settings separate
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
exports = module.exports = {
|
||||
getServerIPv4,
|
||||
getServerIPv6,
|
||||
testConfig,
|
||||
testIPv4Config,
|
||||
testIPv6Config,
|
||||
|
||||
hasIPv6
|
||||
};
|
||||
@@ -33,6 +34,8 @@ async function getServerIPv4() {
|
||||
async function getServerIPv6() {
|
||||
const config = await settings.getSysinfoConfig();
|
||||
|
||||
if (config.provider === 'noop') return null;
|
||||
|
||||
const result = await api(config.provider).getServerIPv6(config);
|
||||
return ipaddr.parse(result).toRFC5952String();
|
||||
}
|
||||
@@ -43,8 +46,14 @@ function hasIPv6() {
|
||||
return fs.existsSync(IPV6_PROC_FILE) && fs.readFileSync(IPV6_PROC_FILE, 'utf8').trim().length !== 0;
|
||||
}
|
||||
|
||||
async function testConfig(config) {
|
||||
async function testIPv4Config(config) {
|
||||
assert.strictEqual(typeof config, 'object');
|
||||
|
||||
return await api(config.provider).testConfig(config);
|
||||
return await api(config.provider).testIPv4Config(config);
|
||||
}
|
||||
|
||||
async function testIPv6Config(config) {
|
||||
assert.strictEqual(typeof config, 'object');
|
||||
|
||||
return await api(config.provider).testIPv6Config(config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user