mirror of https://github.com/2dust/v2rayN
Add Multiplex protocol settings for sing-box
parent
758d0d82d4
commit
7e4f66d533
|
@ -1,9 +1,9 @@
|
|||
<Application
|
||||
x:Class="v2rayN.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
ShutdownMode="OnExplicitShutdown"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
public static readonly List<string> TunMtus = new() { "9000", "1500" };
|
||||
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||
public static readonly List<string> SingboxMuxs = new() { "h2mux", "smux", "yamux", "" };
|
||||
|
||||
#endregion const
|
||||
|
||||
|
|
|
@ -191,6 +191,18 @@ namespace v2rayN.Handler
|
|||
config.guiItem.statisticsFreshRate = 1;
|
||||
}
|
||||
|
||||
if (config.mux4Sbox == null)
|
||||
{
|
||||
config.mux4Sbox = new()
|
||||
{
|
||||
protocol = Global.SingboxMuxs[0],
|
||||
max_connections = 4,
|
||||
min_streams = 4,
|
||||
max_streams = 0,
|
||||
padding = true
|
||||
};
|
||||
}
|
||||
|
||||
LazyConfig.Instance.SetConfig(config);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -288,10 +288,11 @@ namespace v2rayN.Handler
|
|||
var mux = new Multiplex4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
protocol = "smux",
|
||||
max_connections = 4,
|
||||
min_streams = 4,
|
||||
max_streams = 0,
|
||||
protocol = _config.mux4Sbox.protocol,
|
||||
max_connections = _config.mux4Sbox.max_connections,
|
||||
min_streams = _config.mux4Sbox.min_streams,
|
||||
max_streams = _config.mux4Sbox.max_streams,
|
||||
padding = _config.mux4Sbox.padding
|
||||
};
|
||||
outbound.multiplex = mux;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace v2rayN.Handler
|
|||
KillProcess(_process);
|
||||
_process.Dispose();
|
||||
_process = null;
|
||||
hasProc =true;
|
||||
hasProc = true;
|
||||
}
|
||||
|
||||
if (_processPre != null)
|
||||
|
|
|
@ -208,8 +208,8 @@ namespace v2rayN.Handler
|
|||
{
|
||||
updateHandle.UpdateGeoFileAll(config, (bool success, string msg) =>
|
||||
{
|
||||
update(false, msg);
|
||||
});
|
||||
update(false, msg);
|
||||
});
|
||||
autoUpdateGeoTime = dtNow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
public UIItem uiItem { get; set; }
|
||||
public ConstItem constItem { get; set; }
|
||||
public SpeedTestItem speedTestItem { get; set; }
|
||||
public Mux4Sbox mux4Sbox { get; set; }
|
||||
public List<InItem> inbound { get; set; }
|
||||
public List<KeyEventItem> globalHotkeys { get; set; }
|
||||
public List<CoreTypeItem> coreTypeItem { get; set; }
|
||||
|
|
|
@ -191,6 +191,7 @@ namespace v2rayN.Mode
|
|||
/// 域名解析策略
|
||||
/// </summary>
|
||||
public string domainStrategy { get; set; }
|
||||
|
||||
public string domainStrategy4Singbox { get; set; }
|
||||
|
||||
public string domainMatcher { get; set; }
|
||||
|
@ -205,4 +206,14 @@ namespace v2rayN.Mode
|
|||
public int Width { get; set; }
|
||||
public int Index { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Mux4Sbox
|
||||
{
|
||||
public string protocol { get; set; }
|
||||
public int max_connections { get; set; }
|
||||
public int min_streams { get; set; }
|
||||
public int max_streams { get; set; }
|
||||
public bool padding { get; set; }
|
||||
}
|
||||
}
|
|
@ -127,6 +127,7 @@
|
|||
public int max_connections { get; set; }
|
||||
public int min_streams { get; set; }
|
||||
public int max_streams { get; set; }
|
||||
public bool padding { get; set; }
|
||||
}
|
||||
|
||||
public class Utls4Sbox
|
||||
|
|
|
@ -2572,6 +2572,15 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Singbox Mux Protocol 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsMux4SboxProtocol {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsMux4SboxProtocol", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Turn on Mux Multiplexing 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1129,4 +1129,7 @@
|
|||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
<value>Sing-box domain strategy</value>
|
||||
</data>
|
||||
<data name="TbSettingsMux4SboxProtocol" xml:space="preserve">
|
||||
<value>Singbox Mux Protocol</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1126,4 +1126,7 @@
|
|||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
<value>Sing-box域名解析策略</value>
|
||||
</data>
|
||||
<data name="TbSettingsMux4SboxProtocol" xml:space="preserve">
|
||||
<value>Singbox Mux 多路复用协议</value>
|
||||
</data>
|
||||
</root>
|
|
@ -31,6 +31,7 @@ namespace v2rayN.ViewModels
|
|||
[Reactive] public bool defAllowInsecure { get; set; }
|
||||
[Reactive] public string defFingerprint { get; set; }
|
||||
[Reactive] public string defUserAgent { get; set; }
|
||||
[Reactive] public string mux4SboxProtocol { get; set; }
|
||||
|
||||
#endregion Core
|
||||
|
||||
|
@ -131,6 +132,7 @@ namespace v2rayN.ViewModels
|
|||
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
||||
defFingerprint = _config.coreBasicItem.defFingerprint;
|
||||
defUserAgent = _config.coreBasicItem.defUserAgent;
|
||||
mux4SboxProtocol = _config.mux4Sbox.protocol;
|
||||
|
||||
#endregion Core
|
||||
|
||||
|
@ -298,6 +300,7 @@ namespace v2rayN.ViewModels
|
|||
_config.coreBasicItem.defAllowInsecure = defAllowInsecure;
|
||||
_config.coreBasicItem.defFingerprint = defFingerprint;
|
||||
_config.coreBasicItem.defUserAgent = defUserAgent;
|
||||
_config.mux4Sbox.protocol = mux4SboxProtocol;
|
||||
|
||||
//Kcp
|
||||
//_config.kcpItem.mtu = Kcpmtu;
|
||||
|
|
|
@ -126,7 +126,6 @@
|
|||
VerticalScrollBarVisibility="Auto" />
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
|
@ -67,6 +67,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
@ -291,6 +292,21 @@
|
|||
Margin="{StaticResource SettingItemMargin}"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsDefUserAgentTips}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="14"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsMux4SboxProtocol}" />
|
||||
<ComboBox
|
||||
x:Name="cmbmux4SboxProtocol"
|
||||
Grid.Row="14"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
@ -790,34 +806,6 @@
|
|||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsTunModeShowWindow}" />
|
||||
<ToggleButton
|
||||
x:Name="togShowWindow"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsLogEnabled}" />
|
||||
<ToggleButton
|
||||
x:Name="togEnabledLog"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
|
@ -864,33 +852,6 @@
|
|||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsTunModeCustomTemplate}" />
|
||||
<TextBox
|
||||
x:Name="txtCustomTemplate"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Top"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource DefTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
<Button
|
||||
x:Name="btnBrowse"
|
||||
Grid.Row="5"
|
||||
Grid.Column="2"
|
||||
Width="100"
|
||||
Margin="2,0,8,0"
|
||||
Click="btnBrowse_Click"
|
||||
Content="{x:Static resx:ResUI.TbBrowse}"
|
||||
Style="{StaticResource DefButton}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="6"
|
||||
Grid.Column="0"
|
||||
|
|
|
@ -39,6 +39,10 @@ namespace v2rayN.Views
|
|||
{
|
||||
cmbdefUserAgent.Items.Add(it);
|
||||
});
|
||||
Global.SingboxMuxs.ForEach(it =>
|
||||
{
|
||||
cmbmux4SboxProtocol.Items.Add(it);
|
||||
});
|
||||
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
|
@ -134,6 +138,7 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.defAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
||||
|
||||
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.Text).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
||||
|
@ -165,12 +170,9 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.TunShowWindow, v => v.togShowWindow.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunEnabledLog, v => v.togEnabledLog.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunCustomTemplate, v => v.txtCustomTemplate.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunBypassMode, v => v.togBypassMode.IsChecked).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.TunBypassMode, v => v.gridTunModeDirect.Visibility, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.TunBypassMode2, v => v.gridTunModeProxy.Visibility, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
|
@ -203,7 +205,7 @@ namespace v2rayN.Views
|
|||
openFileDialog1.Filter = "tunConfig|*.json|All|*.*";
|
||||
openFileDialog1.ShowDialog();
|
||||
|
||||
txtCustomTemplate.Text = openFileDialog1.FileName;
|
||||
// txtCustomTemplate.Text = openFileDialog1.FileName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ 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);
|
||||
|
|
|
@ -196,7 +196,6 @@
|
|||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="7"
|
||||
Grid.Column="0"
|
||||
|
@ -214,7 +213,6 @@
|
|||
MaxDropDownHeight="1000"
|
||||
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="8"
|
||||
Grid.Column="0"
|
||||
|
|
Loading…
Reference in New Issue