mirror of https://github.com/2dust/v2rayN
Add Sing-box domain strategy
parent
d54a1c2754
commit
768d5cce27
|
@ -141,6 +141,7 @@
|
|||
public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5", "sing_box" };
|
||||
public static readonly List<string> coreTypes4VLESS = new() { "Xray", "sing_box" };
|
||||
public static readonly List<string> domainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
|
||||
public static readonly List<string> domainStrategys4Singbox = new() { "", "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6" };
|
||||
public static readonly List<string> domainMatchers = new() { "linear", "mph", "" };
|
||||
public static readonly List<string> fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
||||
public static readonly List<string> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
||||
|
|
|
@ -133,6 +133,7 @@ namespace v2rayN.Handler
|
|||
inbound.listen_port = LazyConfig.Instance.GetLocalPort(Global.InboundSocks);
|
||||
inbound.sniff = _config.inbound[0].sniffingEnabled;
|
||||
inbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
|
||||
inbound.domain_strategy = Utils.IsNullOrEmpty(_config.routingBasicItem.domainStrategy4Singbox) ? null: _config.routingBasicItem.domainStrategy4Singbox;
|
||||
|
||||
//http
|
||||
var inbound2 = GetInbound(inbound, Global.InboundHttp, 1, false);
|
||||
|
|
|
@ -191,6 +191,7 @@ namespace v2rayN.Mode
|
|||
/// 域名解析策略
|
||||
/// </summary>
|
||||
public string domainStrategy { get; set; }
|
||||
public string domainStrategy4Singbox { get; set; }
|
||||
|
||||
public string domainMatcher { get; set; }
|
||||
public string routingIndexId { get; set; }
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
public string tag { get; set; }
|
||||
public string listen { get; set; }
|
||||
public int? listen_port { get; set; }
|
||||
public string domain_strategy { get; set; }
|
||||
public string? domain_strategy { get; set; }
|
||||
public string interface_name { get; set; }
|
||||
public string inet4_address { get; set; }
|
||||
public string inet6_address { get; set; }
|
||||
|
|
|
@ -1960,6 +1960,15 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Sing-box domain strategy 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbdomainStrategy4Singbox {
|
||||
get {
|
||||
return ResourceManager.GetString("TbdomainStrategy4Singbox", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Edit 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1126,4 +1126,7 @@
|
|||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>Click to import default DNS config</value>
|
||||
</data>
|
||||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
<value>Sing-box domain strategy</value>
|
||||
</data>
|
||||
</root>
|
|
@ -896,7 +896,7 @@
|
|||
<value>域名解析策略</value>
|
||||
</data>
|
||||
<data name="TbenableRoutingAdvanced" xml:space="preserve">
|
||||
<value>启用路由高级功能</value>
|
||||
<value>启用高级功能</value>
|
||||
</data>
|
||||
<data name="TbRoutingTabBlock" xml:space="preserve">
|
||||
<value>3.阻止的Domain或IP</value>
|
||||
|
@ -1123,4 +1123,7 @@
|
|||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>点击导入默认DNS配置</value>
|
||||
</data>
|
||||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
<value>Sing-box域名解析策略</value>
|
||||
</data>
|
||||
</root>
|
|
@ -42,6 +42,9 @@ namespace v2rayN.ViewModels
|
|||
[Reactive]
|
||||
public string domainMatcher { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string domainStrategy4Singbox { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string ProxyDomain { get; set; }
|
||||
|
||||
|
@ -83,6 +86,7 @@ namespace v2rayN.ViewModels
|
|||
enableRoutingAdvanced = _config.routingBasicItem.enableRoutingAdvanced;
|
||||
domainStrategy = _config.routingBasicItem.domainStrategy;
|
||||
domainMatcher = _config.routingBasicItem.domainMatcher;
|
||||
domainStrategy4Singbox = _config.routingBasicItem.domainStrategy4Singbox;
|
||||
|
||||
RefreshRoutingItems();
|
||||
|
||||
|
@ -200,6 +204,7 @@ namespace v2rayN.ViewModels
|
|||
_config.routingBasicItem.domainStrategy = domainStrategy;
|
||||
_config.routingBasicItem.enableRoutingAdvanced = enableRoutingAdvanced;
|
||||
_config.routingBasicItem.domainMatcher = domainMatcher;
|
||||
_config.routingBasicItem.domainStrategy4Singbox = domainStrategy4Singbox;
|
||||
|
||||
EndBindingLockedData();
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@
|
|||
<MenuItem
|
||||
x:Name="menuCheckUpdateSingBoxCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="SingBox Core" />
|
||||
Header="Sing-box Core" />
|
||||
<Separator Margin="-40,5" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateGeo"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
Title="{x:Static resx:ResUI.menuRoutingSetting}"
|
||||
Width="900"
|
||||
Width="990"
|
||||
Height="700"
|
||||
x:TypeArguments="vms:RoutingSettingViewModel"
|
||||
Background="{DynamicResource MaterialDesignPaper}"
|
||||
|
@ -52,7 +52,6 @@
|
|||
Header="{x:Static resx:ResUI.menuRoutingBasicImportRules}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Separator />
|
||||
<Menu Margin="0,8" Style="{StaticResource ToolbarMenu}">
|
||||
<MenuItem x:Name="menuRoutingAdvanced" Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
|
@ -106,7 +105,21 @@
|
|||
Text="{x:Static resx:ResUI.TbdomainMatcher}" />
|
||||
<ComboBox
|
||||
x:Name="cmbdomainMatcher"
|
||||
Width="80"
|
||||
Width="60"
|
||||
Margin="8,0,0,0"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<Separator />
|
||||
<TextBlock
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}">
|
||||
<Hyperlink Click="linkdomainStrategy4Singbox_Click">
|
||||
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<ComboBox
|
||||
x:Name="cmbdomainStrategy4Singbox"
|
||||
Width="100"
|
||||
Margin="8,0,0,0"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</ToolBar>
|
||||
|
|
|
@ -28,6 +28,10 @@ namespace v2rayN.Views
|
|||
{
|
||||
cmbdomainMatcher.Items.Add(it);
|
||||
});
|
||||
Global.domainStrategys4Singbox.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
||||
});
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
|
@ -37,6 +41,7 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.togenableRoutingAdvanced.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy, v => v.cmbdomainStrategy.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainMatcher, v => v.cmbdomainMatcher.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Singbox, v => v.cmbdomainStrategy4Singbox.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.ProxyDomain, v => v.txtProxyDomain.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.ProxyIP, v => v.txtProxyIP.Text).DisposeWith(disposables);
|
||||
|
@ -45,8 +50,8 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.BlockDomain, v => v.txtBlockDomain.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.BlockIP, v => v.txtBlockIP.Text).DisposeWith(disposables);
|
||||
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingBasic, v => v.menuRoutingBasic.IsEnabled).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.menuRoutingAdvanced.IsEnabled).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingBasic, v => v.menuRoutingBasic.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.menuRoutingAdvanced.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingBasic, v => v.tabBasic.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.tabAdvanced.Visibility).DisposeWith(disposables);
|
||||
|
||||
|
@ -101,6 +106,11 @@ namespace v2rayN.Views
|
|||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html");
|
||||
}
|
||||
|
||||
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Utils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/shared/listen/#domain_strategy");
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (ViewModel?.IsModified == true)
|
||||
|
|
Loading…
Reference in New Issue