mirror of
https://github.com/key-networks/ztncui.git
synced 2025-06-06 18:23:44 +02:00
Validate DNS IP
This commit is contained in:
parent
52b1c47a54
commit
03a8c858af
1 changed files with 6 additions and 1 deletions
|
@ -449,15 +449,20 @@ exports.dns = async function (req, res) {
|
||||||
active: 'networks',
|
active: 'networks',
|
||||||
whence: ''
|
whence: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
const dns = {
|
const dns = {
|
||||||
dns: {
|
dns: {
|
||||||
domain: req.body.domain,
|
domain: req.body.domain,
|
||||||
servers: req.body.servers
|
servers: req.body.servers
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(x => x.trim())
|
.map(x => x.trim())
|
||||||
.filter(x => !!x)
|
.filter(ip =>
|
||||||
|
new ipaddr.Address4(ip).isValid() ||
|
||||||
|
new ipaddr.Address6(ip).isValid()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const network = await zt.network_object(req.params.nwid, dns);
|
const network = await zt.network_object(req.params.nwid, dns);
|
||||||
navigate.whence = '/controller/network/' + network.nwid;
|
navigate.whence = '/controller/network/' + network.nwid;
|
||||||
|
|
Loading…
Add table
Reference in a new issue