Add domainStrategy4Singbox in rule set settings

pull/3786/head
2dust 2023-04-28 10:41:50 +08:00
parent ca4e8960d2
commit 419f5458b4
4 changed files with 34 additions and 5 deletions

View File

@ -135,6 +135,15 @@ namespace v2rayN.Handler
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;
if (_config.routingBasicItem.enableRoutingAdvanced)
{
var routing = ConfigHandler.GetDefaultRouting(ref _config);
if (!Utils.IsNullOrEmpty(routing.domainStrategy4Singbox))
{
inbound.domain_strategy = routing.domainStrategy4Singbox;
}
}
//http
var inbound2 = GetInbound(inbound, Global.InboundHttp, 1, false);
singboxConfig.inbounds.Add(inbound2);

View File

@ -16,6 +16,7 @@ namespace v2rayN.Mode
public bool locked { get; set; }
public string customIcon { get; set; }
public string domainStrategy { get; set; }
public string domainStrategy4Singbox { get; set; }
public int sort { get; set; }
}
}

View File

@ -138,13 +138,26 @@
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbdomainStrategy}" />
<ComboBox
x:Name="cmbdomainStrategy"
<StackPanel
Grid.Row="1"
Grid.Column="1"
Width="200"
Margin="4"
Style="{StaticResource DefComboBox}" />
Orientation="Horizontal">
<ComboBox
x:Name="cmbdomainStrategy"
Width="200"
Margin="4"
Style="{StaticResource DefComboBox}" />
<TextBlock
Margin="4"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
<ComboBox
x:Name="cmbdomainStrategy4Singbox"
Width="200"
Margin="4"
Style="{StaticResource DefComboBox}" />
</StackPanel>
<TextBlock
Grid.Row="2"

View File

@ -25,6 +25,10 @@ namespace v2rayN.Views
cmbdomainStrategy.Items.Add(it);
});
cmbdomainStrategy.Items.Add(string.Empty);
Global.domainStrategys4Singbox.ForEach(it =>
{
cmbdomainStrategy4Singbox.Items.Add(it);
});
this.WhenActivated(disposables =>
{
@ -33,6 +37,8 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedRouting.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting.domainStrategy, v => v.cmbdomainStrategy.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting.domainStrategy4Singbox, v => v.cmbdomainStrategy4Singbox.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting.url, v => v.txtUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting.customIcon, v => v.txtCustomIcon.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting.sort, v => v.txtSort.Text).DisposeWith(disposables);