feat: add custom port support to dns

This commit is contained in:
divocat
2025-10-23 20:33:18 +03:00
parent ac258c53c0
commit 2918487845
3 changed files with 21 additions and 5 deletions

View File

@@ -40,10 +40,12 @@ function validateDNS(value) {
if (!value) {
return { valid: false, message: _("DNS server address cannot be empty") };
}
if (validateIPV4(value).valid) {
const cleanedValueWithoutPort = value.replace(/:(\d+)(?=\/|$)/, "");
const cleanedIpWithoutPath = cleanedValueWithoutPort.split("/")[0];
if (validateIPV4(cleanedIpWithoutPath).valid) {
return { valid: true, message: _("Valid") };
}
if (validateDomain(value).valid) {
if (validateDomain(cleanedValueWithoutPort).valid) {
return { valid: true, message: _("Valid") };
}
return {