diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 7b2813d1..514eb343 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -27,17 +27,22 @@ public const string ConfigFileName = "guiNConfig.json"; public const string ConfigDB = "guiNDB.db"; public const string coreConfigFileName = "config.json"; + public const string v2raySampleClient = "v2rayN.Sample.SampleClientConfig"; public const string SingboxSampleClient = "v2rayN.Sample.SingboxSampleClientConfig"; public const string v2raySampleHttprequestFileName = "v2rayN.Sample.SampleHttprequest"; public const string v2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse"; - public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_"; public const string v2raySampleInbound = "v2rayN.Sample.SampleInbound"; + public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_"; + public const string TunSingboxFileName = "v2rayN.Sample.tun_singbox"; public const string TunSingboxDNSFileName = "v2rayN.Sample.tun_singbox_dns"; public const string TunSingboxInboundFileName = "v2rayN.Sample.tun_singbox_inbound"; public const string TunSingboxRulesFileName = "v2rayN.Sample.tun_singbox_rules"; + public const string DNSV2rayNormalFileName = "v2rayN.Sample.dns_v2ray_normal"; + public const string DNSSingboxNormalFileName = "v2rayN.Sample.dns_singbox_normal"; + public const string DefaultSecurity = "auto"; public const string DefaultNetwork = "tcp"; public const string TcpHeaderHttp = "http"; diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index 91ead649..c45a4765 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -2257,6 +2257,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Click to import default DNS config 的本地化字符串。 + /// + public static string TBSettingDnsImportDefConfig { + get { + return ResourceManager.GetString("TBSettingDnsImportDefConfig", resourceCulture); + } + } + /// /// 查找类似 Advanced proxy settings, protocol selection (optional) 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index e57c8d9d..ed1aa3c2 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1123,4 +1123,7 @@ Please fill in DNS Structure, Click to view the document + + Click to import default DNS config + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index bf0dec58..e44180bf 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -1120,4 +1120,7 @@ 请填写 DNS JSON 结构,点击查看文档 + + 点击导入默认DNS配置 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Sample/dns_singbox_normal b/v2rayN/v2rayN/Sample/dns_singbox_normal new file mode 100644 index 00000000..f1c10ee7 --- /dev/null +++ b/v2rayN/v2rayN/Sample/dns_singbox_normal @@ -0,0 +1,31 @@ +{ + "servers": [ + { + "tag": "out_dns", + "address": "8.8.8.8", + "detour": "proxy" + }, + { + "tag": "local", + "address": "223.5.5.5", + "detour": "direct" + }, + { + "tag": "block", + "address": "rcode://success" + } + ], + "rules": [ + { + "geosite": "cn", + "server": "local", + "disable_cache": true + }, + { + "geosite": "category-ads-all", + "server": "block", + "disable_cache": true + } + ], + "strategy": "ipv4_only" +} diff --git a/v2rayN/v2rayN/Sample/dns_v2ray_normal b/v2rayN/v2rayN/Sample/dns_v2ray_normal new file mode 100644 index 00000000..76f7c1ec --- /dev/null +++ b/v2rayN/v2rayN/Sample/dns_v2ray_normal @@ -0,0 +1,26 @@ +{ + "hosts": { + "dns.google": "8.8.8.8", + "proxy.example.com": "127.0.0.1" + }, + "servers": [ + { + "address": "223.5.5.5", + "domains": [ + "geosite:cn" + ], + "expectIPs": [ + "geoip:cn" + ] + }, + { + "address": "https://1.1.1.1/dns-query", + "domains": [ + "geosite:geolocation-!cn" + ] + }, + "1.1.1.1", + "https://dns.google/dns-query" + ], + "queryStrategy": "UseIPv4" +} \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs index 2ada5dbc..ac31cd49 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -20,6 +20,8 @@ namespace v2rayN.ViewModels [Reactive] public string normalDNS2 { get; set; } public ReactiveCommand SaveCmd { get; } + public ReactiveCommand ImportDefConfig4V2rayCmd { get; } + public ReactiveCommand ImportDefConfig4SingboxCmd { get; } public DNSSettingViewModel(Window view) { @@ -39,6 +41,16 @@ namespace v2rayN.ViewModels SaveSetting(); }); + ImportDefConfig4V2rayCmd = ReactiveCommand.Create(() => + { + normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName); + }); + + ImportDefConfig4SingboxCmd = ReactiveCommand.Create(() => + { + normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName); + }); + Utils.SetDarkBorder(view, _config.uiItem.colorModeDark); } diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml index d098a60d..c19509ef 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml @@ -78,6 +78,12 @@ +