From 716029def89a45b123d7435e183eebfcc7256e78 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Dec 2021 20:47:19 +0800 Subject: [PATCH] DNS settings check --- v2rayN/v2rayN/Forms/OptionSettingForm.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index d104d927..e7748b02 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -181,6 +181,21 @@ namespace v2rayN.Forms UI.Show(UIRes.I18N("PleaseSelectProtocol")); return -1; } + + var remoteDNS = txtremoteDNS.Text.TrimEx(); + var obj = Utils.ParseJson(remoteDNS); + if (obj != null && obj.ContainsKey("servers")) + { + } + else + { + if (remoteDNS.Contains("{") || remoteDNS.Contains("}")) + { + UI.Show(UIRes.I18N("FillCorrectDNSText")); + return -1; + } + } + config.inbound[0].localPort = Utils.ToInt(localPort); config.inbound[0].protocol = protocol; config.inbound[0].udpEnabled = udpEnabled; @@ -227,7 +242,7 @@ namespace v2rayN.Forms //Mux config.muxEnabled = muxEnabled; - //remoteDNS + //remoteDNS config.remoteDNS = txtremoteDNS.Text.TrimEx(); config.defAllowInsecure = chkdefAllowInsecure.Checked;