mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-30 11:25:52 +00:00
parent
c4e071cac3
commit
ee6ae3d91d
8 changed files with 76 additions and 26 deletions
|
|
@ -119,6 +119,10 @@ public class BaseFmt
|
|||
{
|
||||
dicQuery.Add("seed", UrlEncodeSafe(transport.KcpSeed));
|
||||
}
|
||||
if (transport.KcpMtu > 0)
|
||||
{
|
||||
dicQuery.Add("mtu", transport.KcpMtu.ToString());
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(ETransport.ws):
|
||||
|
|
@ -279,10 +283,13 @@ public class BaseFmt
|
|||
|
||||
case nameof(ETransport.kcp):
|
||||
var kcpSeed = GetQueryDecoded(query, "seed");
|
||||
var kcpMtuStr = GetQueryValue(query, "mtu");
|
||||
var kcpMtu = int.TryParse(kcpMtuStr, out var mtu) ? mtu : 0;
|
||||
transport = transport with
|
||||
{
|
||||
KcpHeaderType = GetQueryValue(query, "headerType", Global.None),
|
||||
KcpSeed = kcpSeed,
|
||||
KcpMtu = kcpMtu > 0 ? mtu : null,
|
||||
};
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ public record TransportExtraItem
|
|||
|
||||
public string? KcpHeaderType { get; init; }
|
||||
public string? KcpSeed { get; init; }
|
||||
public int? KcpMtu { get; init; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ public partial class CoreConfigV2rayService
|
|||
var host = string.Empty;
|
||||
var path = string.Empty;
|
||||
var kcpSeed = string.Empty;
|
||||
var kcpMtu = 0;
|
||||
var headerType = string.Empty;
|
||||
var xhttpExtra = string.Empty;
|
||||
switch (network)
|
||||
|
|
@ -341,6 +342,7 @@ public partial class CoreConfigV2rayService
|
|||
case nameof(ETransport.kcp):
|
||||
kcpSeed = transport.KcpSeed?.TrimEx() ?? string.Empty;
|
||||
headerType = transport.KcpHeaderType?.TrimEx() ?? string.Empty;
|
||||
kcpMtu = transport.KcpMtu > 0 ? transport.KcpMtu!.Value : _config.KcpItem.Mtu;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.ws):
|
||||
|
|
@ -441,7 +443,7 @@ public partial class CoreConfigV2rayService
|
|||
case nameof(ETransport.kcp):
|
||||
KcpSettings4Ray kcpSettings = new()
|
||||
{
|
||||
mtu = _config.KcpItem.Mtu,
|
||||
mtu = kcpMtu,
|
||||
tti = _config.KcpItem.Tti
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ public class AddServerViewModel : MyReactiveObject
|
|||
[Reactive]
|
||||
public string KcpSeed { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public int? KcpMtu { get; set; }
|
||||
|
||||
public string TransportHeaderType
|
||||
{
|
||||
get => SelectedSource.GetNetwork() switch
|
||||
|
|
@ -287,26 +290,26 @@ public class AddServerViewModel : MyReactiveObject
|
|||
Cert = SelectedSource?.Cert?.ToString() ?? string.Empty;
|
||||
CertSha = SelectedSource?.CertSha?.ToString() ?? string.Empty;
|
||||
|
||||
var protocolExtra = SelectedSource?.GetProtocolExtra();
|
||||
var transport = SelectedSource?.GetTransportExtra();
|
||||
Ports = protocolExtra?.Ports ?? string.Empty;
|
||||
AlterId = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0;
|
||||
Flow = protocolExtra?.Flow ?? string.Empty;
|
||||
SalamanderPass = protocolExtra?.SalamanderPass ?? string.Empty;
|
||||
UpMbps = protocolExtra?.UpMbps;
|
||||
DownMbps = protocolExtra?.DownMbps;
|
||||
HopInterval = protocolExtra?.HopInterval ?? string.Empty;
|
||||
VmessSecurity = protocolExtra?.VmessSecurity?.IsNullOrEmpty() == false ? protocolExtra.VmessSecurity : Global.DefaultSecurity;
|
||||
VlessEncryption = protocolExtra?.VlessEncryption.IsNullOrEmpty() == false ? protocolExtra.VlessEncryption : Global.None;
|
||||
SsMethod = protocolExtra?.SsMethod ?? string.Empty;
|
||||
WgPublicKey = protocolExtra?.WgPublicKey ?? string.Empty;
|
||||
WgInterfaceAddress = protocolExtra?.WgInterfaceAddress ?? string.Empty;
|
||||
WgReserved = protocolExtra?.WgReserved ?? string.Empty;
|
||||
WgMtu = protocolExtra?.WgMtu ?? 1280;
|
||||
Uot = protocolExtra?.Uot ?? false;
|
||||
CongestionControl = protocolExtra?.CongestionControl ?? string.Empty;
|
||||
InsecureConcurrency = protocolExtra?.InsecureConcurrency > 0 ? protocolExtra.InsecureConcurrency : null;
|
||||
NaiveQuic = protocolExtra?.NaiveQuic ?? false;
|
||||
var protocolExtra = SelectedSource?.GetProtocolExtra() ?? new();
|
||||
var transport = SelectedSource?.GetTransportExtra() ?? new();
|
||||
Ports = protocolExtra.Ports ?? string.Empty;
|
||||
AlterId = int.TryParse(protocolExtra.AlterId, out var result) ? result : 0;
|
||||
Flow = protocolExtra.Flow ?? string.Empty;
|
||||
SalamanderPass = protocolExtra.SalamanderPass ?? string.Empty;
|
||||
UpMbps = protocolExtra.UpMbps;
|
||||
DownMbps = protocolExtra.DownMbps;
|
||||
HopInterval = protocolExtra.HopInterval ?? string.Empty;
|
||||
VmessSecurity = protocolExtra.VmessSecurity?.IsNullOrEmpty() == false ? protocolExtra.VmessSecurity : Global.DefaultSecurity;
|
||||
VlessEncryption = protocolExtra.VlessEncryption?.IsNullOrEmpty() == false ? protocolExtra.VlessEncryption : Global.None;
|
||||
SsMethod = protocolExtra.SsMethod ?? string.Empty;
|
||||
WgPublicKey = protocolExtra.WgPublicKey ?? string.Empty;
|
||||
WgInterfaceAddress = protocolExtra.WgInterfaceAddress ?? string.Empty;
|
||||
WgReserved = protocolExtra.WgReserved ?? string.Empty;
|
||||
WgMtu = protocolExtra.WgMtu ?? 1280;
|
||||
Uot = protocolExtra.Uot ?? false;
|
||||
CongestionControl = protocolExtra.CongestionControl ?? string.Empty;
|
||||
InsecureConcurrency = protocolExtra.InsecureConcurrency > 0 ? protocolExtra.InsecureConcurrency : null;
|
||||
NaiveQuic = protocolExtra.NaiveQuic ?? false;
|
||||
|
||||
RawHeaderType = transport.RawHeaderType ?? Global.None;
|
||||
Host = transport.Host ?? string.Empty;
|
||||
|
|
@ -318,6 +321,7 @@ public class AddServerViewModel : MyReactiveObject
|
|||
GrpcMode = transport.GrpcMode.IsNullOrEmpty() ? Global.GrpcGunMode : transport.GrpcMode;
|
||||
KcpHeaderType = transport.KcpHeaderType.IsNullOrEmpty() ? Global.None : transport.KcpHeaderType;
|
||||
KcpSeed = transport.KcpSeed ?? string.Empty;
|
||||
KcpMtu = transport.KcpMtu;
|
||||
}
|
||||
|
||||
private async Task SaveServerAsync()
|
||||
|
|
@ -381,6 +385,7 @@ public class AddServerViewModel : MyReactiveObject
|
|||
GrpcMode = GrpcMode.NullIfEmpty(),
|
||||
KcpHeaderType = KcpHeaderType.NullIfEmpty(),
|
||||
KcpSeed = KcpSeed.NullIfEmpty(),
|
||||
KcpMtu = KcpMtu > 0 ? KcpMtu : null,
|
||||
};
|
||||
|
||||
SelectedSource.SetProtocolExtra(SelectedSource.GetProtocolExtra() with
|
||||
|
|
|
|||
|
|
@ -831,7 +831,7 @@
|
|||
x:Name="gridTransportKcp"
|
||||
ColumnDefinitions="300,Auto"
|
||||
IsVisible="False"
|
||||
RowDefinitions="Auto,Auto">
|
||||
RowDefinitions="Auto,Auto,Auto">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
|
|
@ -843,19 +843,34 @@
|
|||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="MTU" />
|
||||
<TextBox
|
||||
x:Name="txtKcpMtu"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="Seed" />
|
||||
<TextBox
|
||||
x:Name="txtKcpSeed"
|
||||
Grid.Row="1"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||
|
||||
this.Bind(ViewModel, vm => vm.KcpHeaderType, v => v.cmbHeaderTypeKcp.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.KcpSeed, v => v.txtKcpSeed.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.KcpMtu, v => v.txtKcpMtu.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.Host, v => v.txtRequestHostWs.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Path, v => v.txtPathWs.Text).DisposeWith(disposables);
|
||||
|
|
|
|||
|
|
@ -1096,6 +1096,7 @@
|
|||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
|
|
@ -1110,6 +1111,7 @@
|
|||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
|
|
@ -1117,13 +1119,29 @@
|
|||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="MTU" />
|
||||
<TextBox
|
||||
x:Name="txtKcpMtu"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="Seed" />
|
||||
<TextBox
|
||||
x:Name="txtKcpSeed"
|
||||
Grid.Row="1"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
</Grid>
|
||||
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ public partial class AddServerWindow
|
|||
|
||||
this.Bind(ViewModel, vm => vm.KcpHeaderType, v => v.cmbHeaderTypeKcp.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.KcpSeed, v => v.txtKcpSeed.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.KcpMtu, v => v.txtKcpMtu.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.Host, v => v.txtRequestHostWs.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Path, v => v.txtPathWs.Text).DisposeWith(disposables);
|
||||
|
|
|
|||
Loading…
Reference in a new issue