mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 12:32:10 +00:00
Add import default DNS config
This commit is contained in:
parent
c692dd3a66
commit
282ad3ab2d
10 changed files with 110 additions and 1 deletions
|
@ -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";
|
||||
|
|
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -2257,6 +2257,15 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Click to import default DNS config 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TBSettingDnsImportDefConfig {
|
||||
get {
|
||||
return ResourceManager.GetString("TBSettingDnsImportDefConfig", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Advanced proxy settings, protocol selection (optional) 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1123,4 +1123,7 @@
|
|||
<data name="TbDnsSingboxObjectDoc" xml:space="preserve">
|
||||
<value>Please fill in DNS Structure, Click to view the document</value>
|
||||
</data>
|
||||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>Click to import default DNS config</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1120,4 +1120,7 @@
|
|||
<data name="TbDnsSingboxObjectDoc" xml:space="preserve">
|
||||
<value>请填写 DNS JSON 结构,点击查看文档</value>
|
||||
</data>
|
||||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>点击导入默认DNS配置</value>
|
||||
</data>
|
||||
</root>
|
31
v2rayN/v2rayN/Sample/dns_singbox_normal
Normal file
31
v2rayN/v2rayN/Sample/dns_singbox_normal
Normal file
|
@ -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"
|
||||
}
|
26
v2rayN/v2rayN/Sample/dns_v2ray_normal
Normal file
26
v2rayN/v2rayN/Sample/dns_v2ray_normal
Normal file
|
@ -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"
|
||||
}
|
|
@ -20,6 +20,8 @@ namespace v2rayN.ViewModels
|
|||
[Reactive] public string normalDNS2 { get; set; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> ImportDefConfig4V2rayCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,12 @@
|
|||
<TextBlock Text="{x:Static resx:ResUI.TbDnsObjectDoc}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<Button
|
||||
x:Name="btnImportDefConfig4V2ray"
|
||||
Margin="8,0,0,0"
|
||||
Content="{x:Static resx:ResUI.TBSettingDnsImportDefConfig}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
<TextBox
|
||||
x:Name="txtnormalDNS"
|
||||
|
@ -102,6 +108,12 @@
|
|||
<TextBlock Text="{x:Static resx:ResUI.TbDnsSingboxObjectDoc}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<Button
|
||||
x:Name="btnImportDefConfig4Singbox"
|
||||
Margin="8,0,0,0"
|
||||
Content="{x:Static resx:ResUI.TBSettingDnsImportDefConfig}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
<TextBox
|
||||
x:Name="txtnormalDNS2"
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.normalDNS2, v => v.txtnormalDNS2.Text).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,12 @@
|
|||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\tun_singbox_inbound">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\dns_v2ray_normal">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\dns_singbox_normal">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="v2rayN.ico">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
|
|
Loading…
Reference in a new issue