1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 21:26:09 +03:00

添加VLESS的mKCP模式

This commit is contained in:
ProxySU 2020-10-28 20:58:32 +08:00
parent cf529a2a4d
commit 62a4eb9c66
8 changed files with 160 additions and 52 deletions

View File

@ -81,6 +81,7 @@ namespace ProxySU
public static string proxyType = "V2Ray"; //代理类型标识: V2Ray\TrojanGo\Trojan\NaiveProxy public static string proxyType = "V2Ray"; //代理类型标识: V2Ray\TrojanGo\Trojan\NaiveProxy
public static readonly string pwdir = AppDomain.CurrentDomain.BaseDirectory; //执行文件所在目录 public static readonly string pwdir = AppDomain.CurrentDomain.BaseDirectory; //执行文件所在目录
public static bool mKCPvlessIsSet = false; //mKCP是否使用VLESS协议
static bool testDomain = false; //设置标识--域名是否需要检测解析,初始化为不需要 static bool testDomain = false; //设置标识--域名是否需要检测解析,初始化为不需要
static string ipv4 = String.Empty; //保存获取的ipv4地址 static string ipv4 = String.Empty; //保存获取的ipv4地址
static string ipv6 = String.Empty; //保存获取的ipv6地址 static string ipv6 = String.Empty; //保存获取的ipv6地址
@ -1474,10 +1475,18 @@ namespace ProxySU
} }
//else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard")) //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true) else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
{
if(mKCPvlessIsSet == true)
{
inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_mkcp_server_config.json";
}
else
{ {
inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\mkcp_server_config.json"; inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\mkcp_server_config.json";
} }
}
// else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard")) // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
else if (ReceiveConfigurationParameters[0].Contains("Quic") == true) else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
{ {
@ -1816,9 +1825,17 @@ namespace ProxySU
} }
//else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard")) //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true) else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
{
if (mKCPvlessIsSet == true)
{
outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_mkcp_client_config.json";
}
else
{ {
outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\mkcp_client_config.json"; outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\mkcp_client_config.json";
} }
}
// else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard")) // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
else if (ReceiveConfigurationParameters[0].Contains("Quic") == true) else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
{ {
@ -6902,27 +6919,31 @@ namespace ProxySU
#region #region
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
proxyType = "V2Ray";
ResultClientInformation resultClientInformation = new ResultClientInformation();
resultClientInformation.ShowDialog();
return;
//string pwdir = AppDomain.CurrentDomain.BaseDirectory; //string pwdir = AppDomain.CurrentDomain.BaseDirectory;
//MessageBox.Show(pwdir); //MessageBox.Show(pwdir);
ConnectionInfo connectionInfo = GenerateConnectionInfo(); //ConnectionInfo connectionInfo = GenerateConnectionInfo();
if (connectionInfo == null) //if (connectionInfo == null)
{ //{
//****** "远程主机连接信息有误,请检查!" ****** // //****** "远程主机连接信息有误,请检查!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString()); // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
return; // return;
} //}
using (var client = new SshClient(connectionInfo)) //using (var client = new SshClient(connectionInfo))
{ //{
client.Connect(); // client.Connect();
if (client.IsConnected == true) // if (client.IsConnected == true)
{ // {
//******"主机登录成功"****** // //******"主机登录成功"******
SetUpProgressBarProcessing(3); // SetUpProgressBarProcessing(3);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString(); // currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
MainWindowsShowInfo(currentStatus); // MainWindowsShowInfo(currentStatus);
} // }
SetUpNat64(client, true); // SetUpNat64(client, true);
//FilterFastestIP(client); //FilterFastestIP(client);
//string cmdErr = client.RunCommand(@"aaa ee").Error; //string cmdErr = client.RunCommand(@"aaa ee").Error;
//MessageBox.Show(cmdErr); //MessageBox.Show(cmdErr);
@ -6954,7 +6975,7 @@ namespace ProxySU
//{ //{
// MessageBox.Show("disConnected"); // MessageBox.Show("disConnected");
//} //}
} // }
} }
private string CaddyInstallTest(SshClient client) private string CaddyInstallTest(SshClient client)

View File

@ -13,7 +13,7 @@
<RowDefinition Height="0.12*"></RowDefinition> <RowDefinition Height="0.12*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- V2Ray客户端配置参数 --> <!-- V2Ray客户端配置参数 -->
<GroupBox Header="{DynamicResource GroupBoxHeaderClientParameter}" x:Name="GroupBoxV2rayClient" Visibility="Collapsed" Grid.Row="0"> <GroupBox Header="{DynamicResource GroupBoxHeaderClientParameter}" x:Name="GroupBoxV2rayClient" Visibility="Visible" Grid.Row="0">
<Grid > <Grid >
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition> <ColumnDefinition Width="0.5*"></ColumnDefinition>
@ -93,7 +93,7 @@
</Grid> </Grid>
</GroupBox> </GroupBox>
<!-- Trojan-Go客户端配置参数 --> <!-- Trojan-Go客户端配置参数 -->
<GroupBox Header="{DynamicResource GroupBoxHeaderClientParameter}" x:Name="GroupBoxTrojanGoClient" Visibility="Visible" Grid.Row="0"> <GroupBox Header="{DynamicResource GroupBoxHeaderClientParameter}" x:Name="GroupBoxTrojanGoClient" Visibility="Collapsed" Grid.Row="0">
<Grid > <Grid >
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition> <ColumnDefinition Width="0.5*"></ColumnDefinition>

View File

@ -232,6 +232,13 @@ namespace ProxySU
} }
else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true) else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
{ {
if(MainWindow.mKCPvlessIsSet == true)
{
TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
TextBoxEncryption.Text = "none";
HideAlterId();
HideGroupBoxClientQRandURL();
}
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true) if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true)
{ {
TextBoxCamouflageType.Text = "none"; TextBoxCamouflageType.Text = "none";
@ -967,7 +974,8 @@ namespace ProxySU
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false
&& String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false
&& String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
&& String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false) && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false
&& MainWindow.mKCPvlessIsSet == false)
{ {
using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt")) using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
{ {

View File

@ -258,6 +258,14 @@
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Column="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<RadioButton x:Name="RadioButtonVMESSmKCP" Content="VMESS" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"></RadioButton>
<RadioButton x:Name="RadioButtonVLESSmKCP" Content="VLESS" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"></RadioButton>
</Grid>
<RadioButton x:Name="RadioButtonMkcpNone" Content="{DynamicResource RadioButtonV2RayMkcpNone}" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonMkcp_Checked" HorizontalAlignment="Left" VerticalAlignment="Center"></RadioButton> <RadioButton x:Name="RadioButtonMkcpNone" Content="{DynamicResource RadioButtonV2RayMkcpNone}" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonMkcp_Checked" HorizontalAlignment="Left" VerticalAlignment="Center"></RadioButton>
<TextBlock Text="{DynamicResource TextBlockV2RayMkcpNoneExplain}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> <TextBlock Text="{DynamicResource TextBlockV2RayMkcpNoneExplain}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2SRTP" Content="mKCP+SRTP" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonMkcp_Checked" HorizontalAlignment="Left" VerticalAlignment="Center"></RadioButton> <RadioButton x:Name="RadioButton2mKCP2SRTP" Content="mKCP+SRTP" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonMkcp_Checked" HorizontalAlignment="Left" VerticalAlignment="Center"></RadioButton>

View File

@ -48,6 +48,7 @@ namespace ProxySU
//隐藏QUIC密钥 //隐藏QUIC密钥
FirstQuicHideEncryption(); FirstQuicHideEncryption();
RadioButtonVMESSmKCP.IsChecked = true;
} }
//取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态 //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
//代码参考网址https://blog.csdn.net/weixin_42583999/article/details/103468857 //代码参考网址https://blog.csdn.net/weixin_42583999/article/details/103468857
@ -557,6 +558,15 @@ namespace ProxySU
//传递uuid //传递uuid
MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString(); MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString();
if (RadioButtonVLESSmKCP.IsChecked == true)
{
MainWindow.mKCPvlessIsSet = true;
}
else
{
MainWindow.mKCPvlessIsSet = false;
}
if (domainNotEmpty) if (domainNotEmpty)
{ {
this.Close(); this.Close();

Binary file not shown.

View File

@ -0,0 +1,33 @@
{
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "kcp",
"kcpSettings": {
"uplinkCapacity": 100,
"downlinkCapacity": 100,
"congestion": true,
"header": {
"type": null
},
"seed": null
}
}
}
]
}

View File

@ -0,0 +1,28 @@
{
"inbounds": [
{
"port": null,
"protocol": "vless",
"settings": {
"clients": [
{
"id": null
}
],
"decryption": "none"
},
"streamSettings": {
"network": "mkcp",
"kcpSettings": {
"uplinkCapacity": 100,
"downlinkCapacity": 100,
"congestion": true,
"header": {
"type": null
},
"seed": null
}
}
}
]
}