diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index 0ee3769..5486f5c 100644 --- a/ProxySU/MainWindow.xaml +++ b/ProxySU/MainWindow.xaml @@ -104,14 +104,17 @@ + + - + + diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index fcff4f1..110b4a5 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -11,11 +11,11 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -using Renci.SshNet; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.IO; +using Renci.SshNet; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; @@ -777,6 +777,16 @@ namespace ProxySU WindowTemplateConfiguration windowTemplateConfiguration = new WindowTemplateConfiguration(); windowTemplateConfiguration.ShowDialog(); } + private void ButtonGuideConfiguration_Click(object sender, RoutedEventArgs e) + { + MessageBox.Show("尚未完善,敬请期待"); + } + + private void ButtonAdvancedConfiguration_Click(object sender, RoutedEventArgs e) + { + MessageBox.Show("尚未完善,敬请期待"); + } + //测试接收到的模板参数 private void Button_Click(object sender, RoutedEventArgs e) { @@ -815,15 +825,50 @@ namespace ProxySU return; } } - - private void ButtonGuideConfiguration_Click(object sender, RoutedEventArgs e) + //测试生成v2rayN导入格式json +// { +// "v": "2", +// "ps": "", +// "add": "", +// "port": "", +// "id": "", +// "aid": "16", +// "net": "tcp", +// "type": "none", +// "host": "", +// "path": "", +// "tls": "" +//} + private void Button_Click_3(object sender, RoutedEventArgs e) { - MessageBox.Show("尚未完善,敬请期待"); - } + string v2rayNjsonFile = @"{ + ""v"": """", + ""ps"": """", + ""add"": """", + ""port"": """", + ""id"": """", + ""aid"": """", + ""net"": """", + ""type"": """", + ""host"": """", + ""path"": """", + ""tls"": """" +}"; + //MessageBox.Show(v2rayNjsonFile); + JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile); + v2rayNjsonObject["v"] = "2"; + v2rayNjsonObject["add"] = ""; + v2rayNjsonObject["port"] = ""; + v2rayNjsonObject["id"] = ""; + v2rayNjsonObject["aid"] = "16"; + v2rayNjsonObject["net"] = ""; + v2rayNjsonObject["type"] = ""; + v2rayNjsonObject["host"] = ""; + v2rayNjsonObject["path"] = ""; + v2rayNjsonObject["tls"] = ""; + v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; + //MessageBox.Show(v2rayNjsonObject["v"].ToString()); - private void ButtonAdvancedConfiguration_Click(object sender, RoutedEventArgs e) - { - MessageBox.Show("尚未完善,敬请期待"); } } diff --git a/ProxySU/ProxySU.csproj b/ProxySU/ProxySU.csproj index 93bd517..cecb565 100644 --- a/ProxySU/ProxySU.csproj +++ b/ProxySU/ProxySU.csproj @@ -145,6 +145,7 @@ del "$(TargetDir)*.xml" del "$(TargetDir)*.pdb" -"D:\Program Files\7-Zip\7z.exe" a $(TargetDir)Release.zip $(TargetDir) +del "$(TargetDir)*.zip" +"D:\Program Files\7-Zip\7z.exe" a $(TargetDir)Release.zip $(TargetDir) -xr!config \ No newline at end of file diff --git a/ProxySU/ResultClientInformation.xaml b/ProxySU/ResultClientInformation.xaml index fe58065..7277ee1 100644 --- a/ProxySU/ResultClientInformation.xaml +++ b/ProxySU/ResultClientInformation.xaml @@ -24,6 +24,8 @@ + + @@ -34,21 +36,26 @@ - - - - - - - - + + + + + + + + - - + + - - - + + + + + + + + diff --git a/ProxySU/ResultClientInformation.xaml.cs b/ProxySU/ResultClientInformation.xaml.cs index 98a642d..810d9b2 100644 --- a/ProxySU/ResultClientInformation.xaml.cs +++ b/ProxySU/ResultClientInformation.xaml.cs @@ -10,6 +10,14 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using System.IO; +using Renci.SshNet; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; +using System.Drawing; +using QRCoder; + namespace ProxySU { @@ -27,6 +35,8 @@ namespace ProxySU TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1]; //用户ID(uuid) TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2]; + //额外ID + TextBoxUUIDextra.Text = "16"; //路径Path TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3]; //加密方式,一般都为auto @@ -34,36 +44,171 @@ namespace ProxySU //伪装类型 TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5]; - if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP")) + if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web")) { - TextBoxTransmission.Text = "tcp"; - } - else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web")) - { - TextBoxTransmission.Text = "WebSocket(ws)"; + TextBoxTransmission.Text = "ws"; + TextBoxCamouflageType.Text = "none"; + ShowPathAndTLS(); + TextBoxTLS.Text = "tls"; } else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp")) { TextBoxTransmission.Text = "tcp"; - + TextBoxCamouflageType.Text = "http"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); } - else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "MkcpNone") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard")) + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "MkcpNone")) { - TextBoxTransmission.Text = "mKCP(kcp)"; + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "none"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP")) + { + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "srtp"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP")) + { + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "utp"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo")) + { + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "wechat-video"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS")) + { + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "dtls"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard")) + { + TextBoxTransmission.Text = "kcp"; + TextBoxCamouflageType.Text = "wireguard"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); } - else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "HTTP2")) { TextBoxTransmission.Text = "h2"; + TextBoxCamouflageType.Text = "none"; + ShowPathAndTLS(); + TextBoxTLS.Text = "tls"; } else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TLS")) { - TextBoxTransmission.Text = ""; + TextBoxTransmission.Text = "tcp"; + TextBoxCamouflageType.Text = "none"; + TextBoxTLS.Text = "tls"; + HidePathAndTLS(); } - + else + { + TextBoxTransmission.Text = "tcp"; + TextBoxCamouflageType.Text = "none"; + TextBoxTLS.Text = "none"; + HidePathAndTLS(); + } + + GenerateV2rayNshareQRcodeAndBase64Url(); } + private void HidePathAndTLS() + { + TextBlockPath.Visibility = Visibility.Collapsed; + TextBoxPath.Visibility = Visibility.Collapsed; + TextBlockPathExplain.Visibility = Visibility.Collapsed; + //TextBlocTLSonOrNo.Visibility = Visibility.Collapsed; + //TextBoxTLS.Visibility = Visibility.Collapsed; + //TextBlocTLSonOrNoExplain.Visibility = Visibility.Collapsed; + } + private void ShowPathAndTLS() + { + TextBlockPath.Visibility = Visibility.Visible; + TextBoxPath.Visibility = Visibility.Visible; + TextBlockPathExplain.Visibility = Visibility.Visible; + //TextBlocTLSonOrNo.Visibility = Visibility.Visible; + //TextBoxTLS.Visibility = Visibility.Visible; + //TextBlocTLSonOrNoExplain.Visibility = Visibility.Visible; + } + //生成v2rayN客户端导入文件 + private void GenerateV2rayNshareQRcodeAndBase64Url() + { + //生成v2rayN的json文件 + string v2rayNjsonFile = @" +{ + ""v"": """", + ""ps"": """", + ""add"": """", + ""port"": """", + ""id"": """", + ""aid"": """", + ""net"": """", + ""type"": """", + ""host"": """", + ""path"": """", + ""tls"": """" +}"; + //MessageBox.Show(v2rayNjsonFile); + JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile); + v2rayNjsonObject["v"] = "2"; + v2rayNjsonObject["add"] = TextBoxHostAddress.Text.ToString(); //设置域名 + v2rayNjsonObject["port"] = TextBoxPort.Text.ToString(); //设置端口 + v2rayNjsonObject["id"] = TextBoxUUID.Text.ToString(); //设置uuid + v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text.ToString(); //设置额外ID + v2rayNjsonObject["net"] = TextBoxTransmission.Text.ToString(); //设置传输模式 + v2rayNjsonObject["type"] = TextBoxCamouflageType.Text.ToString(); //设置伪装类型 + v2rayNjsonObject["host"] = ""; + v2rayNjsonObject["path"] = TextBoxPath.Text.ToString(); //设置路径 + v2rayNjsonObject["tls"] = TextBoxTLS.Text.ToString(); //设置是否启用TLS + v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注 + //MessageBox.Show(v2rayNjsonObject["v"].ToString()); + + MessageBox.Show(v2rayNjsonObject.ToString()); + string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString()); + using (StreamWriter sw = new StreamWriter(@"config\v2rayNvmessUrl.txt")) + { + sw.WriteLine(vmessUrl); + + } + CreateQRCode(vmessUrl); + + + } + //生成base64 + private string ToBase64Encode(string text) + { + if (String.IsNullOrEmpty(text)) + { + return text; + } + + byte[] textBytes = Encoding.UTF8.GetBytes(text); + return Convert.ToBase64String(textBytes); + } + //生成QRcoder图片 + private void CreateQRCode(string varBase64) + { + //string varBase64 = varBase64; + QRCodeGenerator qrGenerator = new QRCodeGenerator(); + QRCodeData qrCodeData = qrGenerator.CreateQrCode(varBase64, QRCodeGenerator.ECCLevel.Q); + QRCode qrCode = new QRCode(qrCodeData); + Bitmap qrCodeImage = qrCode.GetGraphic(20); + qrCodeImage.Save(@"config\v2rayN.bmp"); + } private void Button_Click(object sender, RoutedEventArgs e) { string openFolderPath = @"config"; diff --git a/ProxySU/bin/Release/ProxySU.exe b/ProxySU/bin/Release/ProxySU.exe index cff4e32..c2a6d94 100644 Binary files a/ProxySU/bin/Release/ProxySU.exe and b/ProxySU/bin/Release/ProxySU.exe differ diff --git a/ProxySU/bin/Release/Release.zip b/ProxySU/bin/Release/Release.zip index e1e3b3b..9d5b84b 100644 Binary files a/ProxySU/bin/Release/Release.zip and b/ProxySU/bin/Release/Release.zip differ