1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-26 07:06:08 +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地址
@ -1475,7 +1476,15 @@ 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)
{ {
inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\mkcp_server_config.json"; 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";
}
} }
// 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"))
@ -1817,7 +1826,15 @@ 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)
{ {
outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\mkcp_client_config.json"; 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";
}
} }
// 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,59 +6919,63 @@ 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);
//SshCommand cmdResult = client.RunCommand(@"pwd"); //SshCommand cmdResult = client.RunCommand(@"pwd");
//string result = cmdResult.Result; //string result = cmdResult.Result;
//MessageBox.Show("result:" + result); //MessageBox.Show("result:" + result);
//string error = cmdResult.Error; //string error = cmdResult.Error;
//MessageBox.Show("err:" + error); //MessageBox.Show("err:" + error);
//int cmdExitStatus = cmdResult.ExitStatus; //int cmdExitStatus = cmdResult.ExitStatus;
//MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString()); //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
//SshCommand cmdResultCat = client.RunCommand(@"cat tt.t"); //SshCommand cmdResultCat = client.RunCommand(@"cat tt.t");
//string resultCat = cmdResultCat.Result; //string resultCat = cmdResultCat.Result;
//MessageBox.Show("resultCat:" + resultCat); //MessageBox.Show("resultCat:" + resultCat);
//string errorCat = cmdResultCat.Error; //string errorCat = cmdResultCat.Error;
//MessageBox.Show("errCat:" + errorCat); //MessageBox.Show("errCat:" + errorCat);
//cmdExitStatus = cmdResultCat.ExitStatus; //cmdExitStatus = cmdResultCat.ExitStatus;
//MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString()); //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
//SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray"); //SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
//CaddyInstall(client); //CaddyInstall(client);
//if (client.IsConnected == true) //if (client.IsConnected == true)
//{ //{
// MessageBox.Show("Connected"); // MessageBox.Show("Connected");
//} //}
//if (client.IsConnected == false) //if (client.IsConnected == false)
//{ //{
// 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,7 +258,15 @@
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonMkcpNone" Content="{DynamicResource RadioButtonV2RayMkcpNone}" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonMkcp_Checked" HorizontalAlignment="Left" VerticalAlignment="Center"></RadioButton> <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>
<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>
<TextBlock Text="{DynamicResource TextBlockV2RayMkcpSRTPExplain}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> <TextBlock Text="{DynamicResource TextBlockV2RayMkcpSRTPExplain}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>

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
}
}
}
]
}