mirror of https://github.com/2dust/v2rayN
Default domain strategy for resolving the outbound domain names -- singbox
parent
c2928be35d
commit
7545763dae
|
@ -172,6 +172,7 @@ namespace v2rayN
|
|||
|
||||
public static readonly List<string> AllowInsecure = new() { "true", "false", "" };
|
||||
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||
public static readonly List<string> SingboxDomainStrategy4Out = new() { "ipv4_only", "prefer_ipv4", "prefer_ipv6", "ipv6_only", "" };
|
||||
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
|
||||
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1", "" };
|
||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||
|
|
|
@ -826,7 +826,7 @@ namespace v2rayN.Handler.CoreConfig
|
|||
}
|
||||
singboxConfig.dns = dns4Sbox;
|
||||
|
||||
GenDnsDomains(node, singboxConfig);
|
||||
GenDnsDomains(node, singboxConfig, item?.domainStrategy4Freedom);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -835,7 +835,7 @@ namespace v2rayN.Handler.CoreConfig
|
|||
return 0;
|
||||
}
|
||||
|
||||
private int GenDnsDomains(ProfileItem? node, SingboxConfig singboxConfig)
|
||||
private int GenDnsDomains(ProfileItem? node, SingboxConfig singboxConfig, string? strategy)
|
||||
{
|
||||
var dns4Sbox = singboxConfig.dns ?? new();
|
||||
dns4Sbox.servers ??= [];
|
||||
|
@ -847,7 +847,7 @@ namespace v2rayN.Handler.CoreConfig
|
|||
tag = tag,
|
||||
address = "223.5.5.5",
|
||||
detour = Global.DirectTag,
|
||||
//strategy = strategy
|
||||
strategy = strategy
|
||||
});
|
||||
|
||||
var lstDomain = singboxConfig.outbounds
|
||||
|
@ -1144,7 +1144,7 @@ namespace v2rayN.Handler.CoreConfig
|
|||
singboxConfig.route.rules.Add(rule);
|
||||
}
|
||||
|
||||
GenDnsDomains(null, singboxConfig);
|
||||
GenDnsDomains(null, singboxConfig, null);
|
||||
//var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
||||
//if (dnsServer != null)
|
||||
//{
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace v2rayN.Models
|
|||
public string stack { get; set; }
|
||||
public int mtu { get; set; }
|
||||
public bool enableExInbound { get; set; }
|
||||
public bool enableIPv6Address { get; set; } = true;
|
||||
public bool enableIPv6Address { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
|
|
@ -2734,6 +2734,15 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Default domain strategy for outbound 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsDomainStrategy4Out {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsDomainStrategy4Out", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Double-click server make active 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1297,4 +1297,7 @@
|
|||
<data name="menuProxiesSelectActivity" xml:space="preserve">
|
||||
<value>Select active node (Enter)</value>
|
||||
</data>
|
||||
<data name="TbSettingsDomainStrategy4Out" xml:space="preserve">
|
||||
<value>Default domain strategy for outbound</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1294,4 +1294,7 @@
|
|||
<data name="menuProxiesSelectActivity" xml:space="preserve">
|
||||
<value>设为活动节点 (Enter)</value>
|
||||
</data>
|
||||
<data name="TbSettingsDomainStrategy4Out" xml:space="preserve">
|
||||
<value>Outbound默认解析策略</value>
|
||||
</data>
|
||||
</root>
|
|
@ -21,6 +21,7 @@ namespace v2rayN.ViewModels
|
|||
[Reactive] public string normalDNS { get; set; }
|
||||
[Reactive] public string normalDNS2 { get; set; }
|
||||
[Reactive] public string tunDNS2 { get; set; }
|
||||
[Reactive] public string domainStrategy4Freedom2 { get; set; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> ImportDefConfig4V2rayCmd { get; }
|
||||
|
@ -34,12 +35,13 @@ namespace v2rayN.ViewModels
|
|||
|
||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.Xray);
|
||||
useSystemHosts = item.useSystemHosts;
|
||||
domainStrategy4Freedom = item?.domainStrategy4Freedom!;
|
||||
normalDNS = item?.normalDNS!;
|
||||
domainStrategy4Freedom = item?.domainStrategy4Freedom ?? string.Empty;
|
||||
normalDNS = item?.normalDNS ?? string.Empty;
|
||||
|
||||
var item2 = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
||||
normalDNS2 = item2?.normalDNS!;
|
||||
tunDNS2 = item2?.tunDNS!;
|
||||
normalDNS2 = item2?.normalDNS ?? string.Empty;
|
||||
tunDNS2 = item2?.tunDNS ?? string.Empty;
|
||||
domainStrategy4Freedom2 = item2?.domainStrategy4Freedom ?? string.Empty;
|
||||
|
||||
SaveCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
@ -105,6 +107,7 @@ namespace v2rayN.ViewModels
|
|||
var item2 = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
||||
item2.normalDNS = JsonUtils.Serialize(JsonUtils.ParseJson(normalDNS2));
|
||||
item2.tunDNS = JsonUtils.Serialize(JsonUtils.ParseJson(tunDNS2));
|
||||
item2.domainStrategy4Freedom = domainStrategy4Freedom2;
|
||||
ConfigHandler.SaveDNSItems(_config, item2);
|
||||
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
|
|
|
@ -132,6 +132,19 @@
|
|||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Out}" />
|
||||
<ComboBox
|
||||
x:Name="cmbdomainStrategy4Out"
|
||||
Width="200"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid Margin="{StaticResource SettingItemMargin}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
|
|
|
@ -34,12 +34,18 @@ namespace v2rayN.Views
|
|||
{
|
||||
cmbdomainStrategy4Freedom.Items.Add(it);
|
||||
});
|
||||
Global.SingboxDomainStrategy4Out.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Out.Items.Add(it);
|
||||
});
|
||||
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.useSystemHosts, v => v.togUseSystemHosts.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS, v => v.txtnormalDNS.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom2, v => v.cmbdomainStrategy4Out.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS2, v => v.txtnormalDNS2.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.tunDNS2, v => v.txttunDNS2.Text).DisposeWith(disposables);
|
||||
|
||||
|
|
Loading…
Reference in New Issue