mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-03 05:22:10 +00:00
Added Hysteria2 support (using sing-box)
This commit is contained in:
parent
7037009ce4
commit
81efd25e0a
13 changed files with 89 additions and 12 deletions
|
@ -75,6 +75,7 @@
|
||||||
public const string trojanProtocol = "trojan://";
|
public const string trojanProtocol = "trojan://";
|
||||||
public const string trojanProtocolLite = "trojan";
|
public const string trojanProtocolLite = "trojan";
|
||||||
public const string hysteria2Protocol = "hysteria2://";
|
public const string hysteria2Protocol = "hysteria2://";
|
||||||
|
public const string hysteria2Protocol2 = "hy2://";
|
||||||
public const string hysteria2ProtocolLite = "hysteria2";
|
public const string hysteria2ProtocolLite = "hysteria2";
|
||||||
|
|
||||||
public const string userEMail = "t@t.tt";
|
public const string userEMail = "t@t.tt";
|
||||||
|
|
|
@ -184,9 +184,9 @@ namespace v2rayN.Handler
|
||||||
config.speedTestItem.speedPingTestUrl = Global.SpeedPingTestUrl;
|
config.speedTestItem.speedPingTestUrl = Global.SpeedPingTestUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.mux4Sbox == null)
|
if (config.mux4SboxItem == null)
|
||||||
{
|
{
|
||||||
config.mux4Sbox = new()
|
config.mux4SboxItem = new()
|
||||||
{
|
{
|
||||||
protocol = Global.SingboxMuxs[0],
|
protocol = Global.SingboxMuxs[0],
|
||||||
max_connections = 4,
|
max_connections = 4,
|
||||||
|
@ -196,6 +196,16 @@ namespace v2rayN.Handler
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.hysteriaItem == null)
|
||||||
|
{
|
||||||
|
config.hysteriaItem = new()
|
||||||
|
{
|
||||||
|
up_mbps = 100,
|
||||||
|
down_mbps = 100
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LazyConfig.Instance.SetConfig(config);
|
LazyConfig.Instance.SetConfig(config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,6 +289,9 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
|
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
||||||
|
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
||||||
|
|
||||||
outboundMux(node, outbound);
|
outboundMux(node, outbound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
profileItem = ResolveStdVLESS(result);
|
profileItem = ResolveStdVLESS(result);
|
||||||
}
|
}
|
||||||
else if (result.StartsWith(Global.hysteria2Protocol))
|
else if (result.StartsWith(Global.hysteria2Protocol) || result.StartsWith(Global.hysteria2Protocol2))
|
||||||
{
|
{
|
||||||
msg = ResUI.ConfigurationFormatIncorrect;
|
msg = ResUI.ConfigurationFormatIncorrect;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace v2rayN.Handler
|
||||||
_selecteds = new List<ServerTestItem>();
|
_selecteds = new List<ServerTestItem>();
|
||||||
foreach (var it in selecteds)
|
foreach (var it in selecteds)
|
||||||
{
|
{
|
||||||
if (it.configType == EConfigType.Custom)
|
if (it.configType == EConfigType.Custom || it.configType == EConfigType.Hysteria2)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
public UIItem uiItem { get; set; }
|
public UIItem uiItem { get; set; }
|
||||||
public ConstItem constItem { get; set; }
|
public ConstItem constItem { get; set; }
|
||||||
public SpeedTestItem speedTestItem { get; set; }
|
public SpeedTestItem speedTestItem { get; set; }
|
||||||
public Mux4Sbox mux4Sbox { get; set; }
|
public Mux4SboxItem mux4SboxItem { get; set; }
|
||||||
|
public HysteriaItem hysteriaItem { get; set; }
|
||||||
public List<InItem> inbound { get; set; }
|
public List<InItem> inbound { get; set; }
|
||||||
public List<KeyEventItem> globalHotkeys { get; set; }
|
public List<KeyEventItem> globalHotkeys { get; set; }
|
||||||
public List<CoreTypeItem> coreTypeItem { get; set; }
|
public List<CoreTypeItem> coreTypeItem { get; set; }
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Mux4Sbox
|
public class Mux4SboxItem
|
||||||
{
|
{
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
public int max_connections { get; set; }
|
public int max_connections { get; set; }
|
||||||
|
@ -206,4 +206,11 @@ namespace v2rayN.Mode
|
||||||
public int max_streams { get; set; }
|
public int max_streams { get; set; }
|
||||||
public bool padding { get; set; }
|
public bool padding { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class HysteriaItem
|
||||||
|
{
|
||||||
|
public int up_mbps { get; set; }
|
||||||
|
public int down_mbps { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -2563,6 +2563,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Hysteria Max bandwidth (Up/Dw) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsHysteriaBandwidth {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsHysteriaBandwidth", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Ignore Geo files when updating core 的本地化字符串。
|
/// 查找类似 Ignore Geo files when updating core 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1141,4 +1141,7 @@
|
||||||
<data name="menuAddHysteria2Server" xml:space="preserve">
|
<data name="menuAddHysteria2Server" xml:space="preserve">
|
||||||
<value>Add [Trojan] server</value>
|
<value>Add [Trojan] server</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
|
||||||
|
<value>Hysteria Max bandwidth (Up/Dw)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1138,4 +1138,7 @@
|
||||||
<data name="menuAddHysteria2Server" xml:space="preserve">
|
<data name="menuAddHysteria2Server" xml:space="preserve">
|
||||||
<value>添加[Hysteria2]服务器</value>
|
<value>添加[Hysteria2]服务器</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
|
||||||
|
<value>Hysteria 最大带宽(Up/Dw)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -32,6 +32,8 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public string defFingerprint { get; set; }
|
[Reactive] public string defFingerprint { get; set; }
|
||||||
[Reactive] public string defUserAgent { get; set; }
|
[Reactive] public string defUserAgent { get; set; }
|
||||||
[Reactive] public string mux4SboxProtocol { get; set; }
|
[Reactive] public string mux4SboxProtocol { get; set; }
|
||||||
|
[Reactive] public int hyUpMbps { get; set; }
|
||||||
|
[Reactive] public int hyDownMbps { get; set; }
|
||||||
|
|
||||||
#endregion Core
|
#endregion Core
|
||||||
|
|
||||||
|
@ -120,7 +122,9 @@ namespace v2rayN.ViewModels
|
||||||
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
||||||
defFingerprint = _config.coreBasicItem.defFingerprint;
|
defFingerprint = _config.coreBasicItem.defFingerprint;
|
||||||
defUserAgent = _config.coreBasicItem.defUserAgent;
|
defUserAgent = _config.coreBasicItem.defUserAgent;
|
||||||
mux4SboxProtocol = _config.mux4Sbox.protocol;
|
mux4SboxProtocol = _config.mux4SboxItem.protocol;
|
||||||
|
hyUpMbps = _config.hysteriaItem.up_mbps;
|
||||||
|
hyDownMbps = _config.hysteriaItem.down_mbps;
|
||||||
|
|
||||||
#endregion Core
|
#endregion Core
|
||||||
|
|
||||||
|
@ -274,7 +278,9 @@ namespace v2rayN.ViewModels
|
||||||
_config.coreBasicItem.defAllowInsecure = defAllowInsecure;
|
_config.coreBasicItem.defAllowInsecure = defAllowInsecure;
|
||||||
_config.coreBasicItem.defFingerprint = defFingerprint;
|
_config.coreBasicItem.defFingerprint = defFingerprint;
|
||||||
_config.coreBasicItem.defUserAgent = defUserAgent;
|
_config.coreBasicItem.defUserAgent = defUserAgent;
|
||||||
_config.mux4Sbox.protocol = mux4SboxProtocol;
|
_config.mux4SboxItem.protocol = mux4SboxProtocol;
|
||||||
|
_config.hysteriaItem.up_mbps = hyUpMbps;
|
||||||
|
_config.hysteriaItem.down_mbps = hyDownMbps;
|
||||||
|
|
||||||
//Kcp
|
//Kcp
|
||||||
//_config.kcpItem.mtu = Kcpmtu;
|
//_config.kcpItem.mtu = Kcpmtu;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<reactiveui:ReactiveWindow
|
<reactiveui:ReactiveWindow
|
||||||
x:Class="v2rayN.Views.OptionSettingWindow"
|
x:Class="v2rayN.Views.OptionSettingWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
xmlns:reactiveui="http://reactiveui.net"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:reactiveui="http://reactiveui.net"
|
||||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||||
Title="{x:Static resx:ResUI.menuSetting}"
|
Title="{x:Static resx:ResUI.menuSetting}"
|
||||||
|
@ -68,6 +68,7 @@
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
@ -307,6 +308,37 @@
|
||||||
Width="200"
|
Width="200"
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="15"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbSettingsHysteriaBandwidth}" />
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="15"
|
||||||
|
Grid.Column="1"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtUpMbps"
|
||||||
|
Width="90"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
materialDesign:HintAssist.Hint="Up"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtDownMbps"
|
||||||
|
Width="90"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
materialDesign:HintAssist.Hint="Down"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
|
@ -151,6 +151,8 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).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.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.hyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.hyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.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);
|
//this.Bind(ViewModel, vm => vm.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
||||||
|
|
Loading…
Reference in a new issue