1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-26 07:06:08 +03:00

增加vless+tcp+tls+web,修复几处Bug,代码结构优化

This commit is contained in:
ProxySU 2020-08-25 07:59:16 +08:00
parent e7afe102b3
commit 6475544bbf
18 changed files with 2532 additions and 2573 deletions

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProxySU - v1.8.4" Height="600" Width="530">
Title="ProxySU - v1.8.5" Height="600" Width="530">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.com/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>
@ -60,12 +60,12 @@
<RowDefinition ></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="主机名" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock>
<TextBlock Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock>
<TextBlock Text="主机名" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock>
<TextBlock Text="端口" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock>
<TextBox x:Name="TextBoxHost" Text="" Style="{StaticResource TitleText}" Tag="IP或域名(不可为空)" Margin="5" Grid.Column="1" Grid.Row="0"></TextBox>
<TextBox x:Name="TextBoxPort" CommandManager.PreviewExecuted="TextBoxPort_PreviewExecuted" Text="22" Margin="5" Grid.Column="3" Grid.Row="0" PreviewTextInput="TextBoxPort_PreviewTextInput"/>
<TextBlock Text="用户名:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBlock x:Name="TextBlockPassword" Text="密码:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="用户名:" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBlock x:Name="TextBlockPassword" Text="密码:" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBox x:Name="TextBoxUserName" Text="root" Margin="5" Grid.Column="1" Grid.Row="1"></TextBox>
<PasswordBox x:Name="PasswordBoxHostPassword" Password="" Margin="5" Grid.Column="3" Grid.Row="1"></PasswordBox>
<RadioButton x:Name="RadioButtonPasswordLogin" GroupName="CertIsYesNo" Content="密码登录" Visibility="Hidden" Grid.Column="0" Grid.Row="2" Checked="RadioButtonPasswordLogin_Checked"></RadioButton>

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
<Window x:Class="ProxySU.NaiveProxyResultInfoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="NaiveProxyResultInfoWindow" Height="300" Width="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="0.5*"></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="服务器连接参数" Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.4*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBox x:Name="TextBoxNaiveServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="用户名:" Grid.Column="0" Grid.Row="2"></TextBlock>
<TextBox x:Name="TextBoxNaiveUser" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密码:" Grid.Column="0" Grid.Row="3"></TextBlock>
<TextBox x:Name="TextBoxNaivePassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
<Button x:Name="ButtonOpenDir" Content="确定" Grid.Column="1" Grid.Row="4" Margin="40,3,40,3" Click="ButtonOpenDir_Click"></Button>
</Grid>
</GroupBox>
<GroupBox Header="NaiveGUI导入URL" Grid.Row="1">
<TextBox x:Name="TextBoxNaiveGUIurl" Margin="10" TextWrapping="Wrap"></TextBox>
</GroupBox>
</Grid>
</Window>

View File

@ -1,119 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
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
{
/// <summary>
/// NaiveProxyResultInfoWindow.xaml 的交互逻辑
/// </summary>
public partial class NaiveProxyResultInfoWindow : Window
{
private string saveFileFolder = "";
public NaiveProxyResultInfoWindow()
{
InitializeComponent();
TextBoxNaiveServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
TextBoxNaiveUser.Text = MainWindow.ReceiveConfigurationParameters[3];
TextBoxNaivePassword.Text= MainWindow.ReceiveConfigurationParameters[2];
GenerateV2rayShareQRcodeAndBase64Url();
}
private void GenerateV2rayShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxNaiveServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("naive_config");
while (Directory.Exists(@"naive_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"naive_config\" + saveFileFolder);
string naiveUrl = $"https://{TextBoxNaiveUser.Text}:{TextBoxNaivePassword.Text}@{TextBoxNaiveServerHost.Text}:443/?name={TextBoxNaiveServerHost.Text}&padding=true";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxNaiveGUIurl.Text = naiveUrl;
using (StreamWriter sw = new StreamWriter($"naive_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(naiveUrl);
}
//CreateQRCode(trojanUrl);
//移动NaiveProxy官方程序配置文件到相应目录
if (File.Exists(@"naive_config\config.json"))
{
File.Move(@"naive_config\config.json", @"naive_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"naive_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为NaiveProxy官方程序所使用的客户端配置文件配置为全局模式socks5地址127.0.0.1:1080");
sw.WriteLine("NaiveProxy官方网站https://github.com/klzgrad/naiveproxy");
sw.WriteLine("NaiveProxy官方程序下载地址https://github.com/klzgrad/naiveproxy/releases");
sw.WriteLine("下载相应版本Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录运行naive.exe即可。");
sw.WriteLine("-----------------------------------------\n");
//sw.WriteLine("其他平台的客户端,暂未发布");
//sw.WriteLine("QR.bmp");
//sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点");
//sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
//sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
//sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
//sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为NaiveGUI(windows)复制粘贴导入节点的网址");
sw.WriteLine("NaiveGUI(windows)下载网址https://github.com/ExcitedCodes/NaiveGUI/releases");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxNaiveServerHost.Text}");
sw.WriteLine($"用户名:{TextBoxNaiveUser.Text}");
sw.WriteLine($"密钥:{TextBoxNaivePassword.Text}");
}
}
//判断目录是否存在,不存在则创建
private static bool CheckDir(string folder)
{
try
{
if (!Directory.Exists(folder))//如果不存在就创建file文件夹
Directory.CreateDirectory(folder);//创建该文件夹  
return true;
}
catch (Exception)
{
return false;
}
}
private void ButtonOpenDir_Click(object sender, RoutedEventArgs e)
{
string openFolderPath = @"naive_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
}
}

View File

@ -81,27 +81,18 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="NaiveProxyResultInfoWindow.xaml.cs">
<DependentUpon>NaiveProxyResultInfoWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ProofreadTimeWindow.xaml.cs">
<DependentUpon>ProofreadTimeWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ResultClientInformation.xaml.cs">
<DependentUpon>ResultClientInformation.xaml</DependentUpon>
</Compile>
<Compile Include="TemplateConfiguration.xaml.cs">
<DependentUpon>TemplateConfiguration.xaml</DependentUpon>
</Compile>
<Compile Include="TrojanGoResultClientInfoWindow.xaml.cs">
<DependentUpon>TrojanGoResultClientInfoWindow.xaml</DependentUpon>
<Compile Include="V2RayTemplateWindow.xaml.cs">
<DependentUpon>V2RayTemplateWindow.xaml</DependentUpon>
</Compile>
<Compile Include="TrojanGoTemplateWindow.xaml.cs">
<DependentUpon>TrojanGoTemplateWindow.xaml</DependentUpon>
</Compile>
<Compile Include="TrojanResultClientInfoWindow.xaml.cs">
<DependentUpon>TrojanResultClientInfoWindow.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -114,10 +105,6 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="NaiveProxyResultInfoWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProofreadTimeWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -126,11 +113,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TemplateConfiguration.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TrojanGoResultClientInfoWindow.xaml">
<Page Include="V2RayTemplateWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@ -138,10 +121,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TrojanResultClientInfoWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">

View File

@ -7,8 +7,13 @@
mc:Ignorable="d"
Title="ResultClientInformation" Height="650" Width="600">
<Grid>
<GroupBox Header="服务器连接配置">
<Grid>
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="0.12*"></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="V2Ray 客户端配置参数" x:Name="GroupBoxV2rayClient" Visibility="Visible" Grid.Row="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
@ -26,14 +31,7 @@
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="地址(address)" Grid.Column="0" Grid.Row="0" Margin="1"></TextBlock>
<TextBox x:Name="TextBoxHostAddress" IsReadOnly="True" Grid.Column="1" Grid.Row="0" Margin="2"></TextBox>
@ -44,9 +42,9 @@
<TextBlock Text="用户ID(uuid)" Grid.Column="0" Grid.Row="2" Margin="1"></TextBlock>
<TextBox x:Name="TextBoxUUID" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="2"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="额外ID" Grid.Column="0" Grid.Row="3" Margin="1"></TextBlock>
<TextBlock x:Name="TextBlockUUIDextra" Text="额外ID" Grid.Column="0" Grid.Row="3" Margin="1"></TextBlock>
<TextBox x:Name="TextBoxUUIDextra" IsReadOnly="False" Grid.Column="1" Grid.Row="3" Margin="2"></TextBox>
<TextBlock Text="默认16可以填不超过64的值客户端没有此选项可不填" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3"></TextBlock>
<TextBlock x:Name="TextBlockUUIDextraExplanation" Text="默认16可以填不超过64的值客户端没有此选项可不填" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3"></TextBlock>
<TextBlock Text="加密方式" Grid.Column="0" Grid.Row="4" Margin="1"></TextBlock>
<TextBox x:Name="TextBoxEncryption" IsReadOnly="True" Grid.Column="1" Grid.Row="4" Margin="2"></TextBox>
<TextBlock Text="默认auto" Grid.Column="2" Grid.Row="4"></TextBlock>
@ -70,21 +68,149 @@
<TextBox x:Name="TextBoxQuicKey" IsReadOnly="True" Grid.Column="1" Grid.Row="10" Margin="2"></TextBox>
<TextBlock x:Name="TextBlockQuicKeyExplain" Text="说明" Grid.Column="2" Grid.Row="10"></TextBlock>
<TextBlock Text="以上参数可以手动输入客户端用于V2ray官方客户端的配置文件已经存放入config目录下点击确定可打开" Grid.Column="0" Grid.Row="11" Grid.ColumnSpan="2" TextWrapping="Wrap"></TextBlock>
<Button x:Name="ButtonOpenSaveDir" Content="确定" Grid.Column="2" Grid.Row="11" Grid.RowSpan="1" Margin="5" Click="ButtonOpenSaveDir_Click"></Button>
<Grid Grid.Column="0" Grid.Row="12" Grid.ColumnSpan="2" Grid.RowSpan="7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="85"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="二维码和vmess链接可用于&#x0a;&#x0a;v2rayN(windows)&#x0a;&#x0a;Trojan-QT5(windows)&#x0a;&#x0a;Qv2ray(windows)&#x0a;&#x0a;Shadowrocket(ios)&#x0a;&#x0a;v2rayNG(Android)&#x0a;&#x0a;导入v2ray节点" TextWrapping="Wrap" Grid.Column="0"></TextBlock>
<Image x:Name="ImageShareQRcode" Grid.Column="1"></Image>
</Grid>
</Grid>
<TextBox x:Name="TextBoxvVmessUrl" TextWrapping="Wrap" Grid.Column="2" Grid.Row="12" Grid.RowSpan="7"></TextBox>
</Grid>
</GroupBox>
<GroupBox Header="Trojan-go 客户端配置参数" x:Name="GroupBoxTrojanGoClient" Visibility="Collapsed" Grid.Row="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" ></TextBlock>
<TextBox x:Name="TextBoxTrojanGoServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="端口:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxTrojanGoServerPort" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密钥:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxTrojanGoServerPassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
<TextBlock x:Name="TextBlockTrojanGoWebSocketPath" Text="WebSocket路径" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxTrojanGoWSPath" Grid.Column="1" Grid.Row="4" Margin="4"></TextBox>
<TextBlock x:Name="TextBlockTrojanGoCaption" Grid.Column="2" Grid.Row="4"></TextBlock>
</Grid>
</GroupBox>
<GroupBox Header="Trojan 客户端配置参数" x:Name="GroupBoxTrojanClient" Visibility="Collapsed" Grid.Row="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" ></TextBlock>
<TextBox x:Name="TextBoxTrojanServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="端口:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPort" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密钥:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
</Grid>
</GroupBox>
<GroupBox Header="NaiveProxy 客户端配置参数" x:Name="GroupBoxNaiveProxyClient" Visibility="Collapsed" Grid.Row="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxNaiveServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="用户名:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxNaiveUser" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密码:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxNaivePassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
<!--<Button x:Name="ButtonOpenDir" Content="确定" Grid.Column="1" Grid.Row="4" Margin="40,3,40,3" Click="ButtonOpenDir_Click"></Button>-->
</Grid>
</GroupBox>
<!--<GroupBox Header="客户端配置参数" x:Name="GroupBoxClient" Visibility="Collapsed" Grid.Row="0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</GroupBox>-->
<GroupBox Header="二维码/URL" Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.6*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlockQrURLexplain" Text="二维码和URL链接可用于&#x0a;&#x0a;v2rayN(windows)&#x0a;&#x0a;Trojan-QT5(windows)&#x0a;&#x0a;Qv2ray(windows)&#x0a;&#x0a;Shadowrocket(ios)&#x0a;&#x0a;v2rayNG(Android)&#x0a;&#x0a;导入v2ray节点" TextWrapping="Wrap" Grid.Column="0"></TextBlock>
<Image x:Name="ImageShareQRcode" Grid.Column="1"></Image>
<TextBox x:Name="TextBoxURL" TextWrapping="Wrap" Grid.Column="2"></TextBox>
</Grid>
</GroupBox>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="以上参数可以手动或扫描输入客户端,用于官方客户端的配置和相关文件已经存放入目录下,点击 确定 按扭可打开" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1" Margin="5" TextWrapping="Wrap"></TextBlock>
<Button x:Name="ButtonOpenSaveDir" Content="确定" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1" Margin="5" Click="ButtonOpenSaveDir_Click"></Button>
</Grid>
</Grid>
</Window>

View File

@ -31,32 +31,42 @@ namespace ProxySU
{
InitializeComponent();
if (String.Equals(MainWindow.proxyType, "V2Ray"))
{
GroupBoxV2rayClient.Visibility = Visibility.Visible;
GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
//主机地址
TextBoxHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
//主机端口
TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
//用户ID(uuid)
TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
//额外ID
TextBoxUUIDextra.Text = "16";
//路径Path
TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3];
//主机地址
TextBoxHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
//TLS的Host
TextBoxHost.Text = "";
//加密方式一般都为auto
TextBoxEncryption.Text = "auto";
//传输协议
TextBoxTransmission.Text = "";
//伪装类型
TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
//是否启用TLS
TextBoxTLS.Text = "none";
//TLS的Host
TextBoxHost.Text = "";
//路径Path
TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3];
//QUIC密钥
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web"))
{
TextBoxTransmission.Text = "ws";
TextBoxCamouflageType.Text = "none";
TextBoxTLS.Text = "tls";
ShowPath();
HideQuicKey();
TextBoxTransmission.Text = "ws"; //传输协议
TextBoxCamouflageType.Text = "none"; //伪装类型
TextBoxTLS.Text = "tls"; //是否启用TLS
ShowPath(); //显示路径
HideQuicKey(); //隐藏Quic\mKCP密钥
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP"))
{
@ -90,6 +100,16 @@ namespace ProxySU
HidePath();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb"))
{
TextBoxTransmission.Text = "tcp";
TextBoxCamouflageType.Text = "none";
TextBoxEncryption.Text = "none";
TextBoxTLS.Text = "tls";
HideAlterId();
HidePath();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "webSocket"))
{
TextBoxTransmission.Text = "ws";
@ -259,8 +279,75 @@ namespace ProxySU
CheckDir("v2ray_config");
GenerateV2rayShareQRcodeAndBase64Url();
}
else if (String.Equals(MainWindow.proxyType, "TrojanGo"))
{
//GroupBoxTrojanClient.Header = "Trojan-go 客户端配置参数";
GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanGoClient.Visibility = Visibility.Visible;
GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
TextBoxTrojanGoWSPath.Visibility = Visibility.Hidden;
TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Hidden;
TextBlockTrojanGoCaption.Visibility = Visibility.Hidden;
TextBlockQrURLexplain.Text = "可用于ShadowRocket (ios)、igniterAndroid、Trojan-QT5 (windows) 扫码和导入url";
//主机地址
TextBoxTrojanGoServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
//主机端口
TextBoxTrojanGoServerPort.Text = "443";
//密钥uuid
TextBoxTrojanGoServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
//WebSocket路径
if (MainWindow.ReceiveConfigurationParameters[0].Equals("TrojanGoWebSocketTLS2Web"))
{
TextBoxTrojanGoWSPath.Text = MainWindow.ReceiveConfigurationParameters[3];
TextBoxTrojanGoWSPath.Visibility = Visibility.Visible;
TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Visible;
TextBlockTrojanGoCaption.Visibility = Visibility.Visible;
}
CheckDir("trojan-go_config");
GenerateTrojanGoShareQRcodeAndBase64Url();
}
else if (String.Equals(MainWindow.proxyType, "Trojan"))
{
GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanClient.Visibility = Visibility.Visible;
GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
//主机地址
TextBoxTrojanServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
//主机端口
TextBoxTrojanServerPort.Text = "443";
//密钥uuid
TextBoxTrojanServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
TextBlockQrURLexplain.Text = "可用于ShadowRocket (ios)、igniterAndroid、Trojan-QT5 (windows) 扫码和导入url";
CheckDir("trojan_config");
GenerateTrojanShareQRcodeAndBase64Url();
}
else if (String.Equals(MainWindow.proxyType, "NaiveProxy"))
{
GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
GroupBoxNaiveProxyClient.Visibility = Visibility.Visible;
TextBlockQrURLexplain.Text = "用于NaiveGUI(windows)的URL导入链接";
TextBoxNaiveServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
TextBoxNaiveUser.Text = MainWindow.ReceiveConfigurationParameters[3];
TextBoxNaivePassword.Text = MainWindow.ReceiveConfigurationParameters[2];
GenerateNaivePrxoyShareQRcodeAndBase64Url();
}
}
#region
private void HidePath()
{
TextBlockPath.Visibility = Visibility.Collapsed;
@ -281,6 +368,20 @@ namespace ProxySU
TextBoxQuicKey.Visibility = Visibility.Collapsed;
TextBlockQuicKeyExplain.Visibility = Visibility.Collapsed;
}
private void ShowAlterId()
{
TextBlockUUIDextra.Visibility = Visibility.Visible;
TextBoxUUIDextra.Visibility = Visibility.Visible;
TextBlockUUIDextraExplanation.Visibility = Visibility.Visible;
}
private void HideAlterId()
{
TextBlockUUIDextra.Visibility = Visibility.Collapsed;
TextBoxUUIDextra.Visibility = Visibility.Collapsed;
TextBlockUUIDextraExplanation.Visibility = Visibility.Collapsed;
}
private void ShowQuicKey()
{
@ -289,6 +390,7 @@ namespace ProxySU
TextBlockQuicKeyExplain.Visibility = Visibility.Visible;
}
#endregion
//生成v2rayN客户端导入文件
private void GenerateV2rayShareQRcodeAndBase64Url()
{
@ -344,13 +446,13 @@ namespace ProxySU
CheckDir(@"v2ray_config\" + saveFileFolder);
//MessageBox.Show(v2rayNjsonObject.ToString());
string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxvVmessUrl.Text = vmessUrl;
TextBoxURL.Text = vmessUrl;
using (StreamWriter sw = new StreamWriter($"v2ray_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(vmessUrl);
}
CreateQRCode(vmessUrl);
CreateQRCode(vmessUrl,"v2ray_config");
if (File.Exists(@"v2ray_config\config.json"))
{
@ -395,6 +497,190 @@ namespace ProxySU
}
//生成TrojanGo客户端资料
private void GenerateTrojanGoShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("trojan-go_config");
while (Directory.Exists(@"trojan-go_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"trojan-go_config\" + saveFileFolder);
string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}?allowinsecure=0&tfo=0&sni=&mux=0&ws=0&group=#{TextBoxTrojanServerHost.Text}";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxURL.Text = trojanUrl;
using (StreamWriter sw = new StreamWriter($"trojan-go_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(trojanUrl);
}
CreateQRCode(trojanUrl, "trojan-go_config");
//移动Trojan官方程序配置文件到相应目录
if (File.Exists(@"trojan-go_config\config.json"))
{
File.Move(@"trojan-go_config\config.json", @"trojan-go_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"trojan-go_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为Trojan-go官方程序所使用的客户端配置文件配置为全局模式http与socks5地址127.0.0.1:1080");
sw.WriteLine("Trojan-go官方网站https://github.com/p4gefau1t/trojan-go");
sw.WriteLine("Trojan-go官方程序下载地址https://github.com/p4gefau1t/trojan-go/releases");
sw.WriteLine("下载相应版本Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录运行trojan.exe即可。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("QR.bmp");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点Trojan-Go的WebSocket模式暂不支持");
sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)复制粘贴导入节点的网址Trojan-Go的WebSocket模式暂不支持");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxTrojanServerHost.Text}");
sw.WriteLine($"端口(Port){TextBoxTrojanServerPort.Text}");
sw.WriteLine($"密钥:{TextBoxTrojanServerPassword.Text}");
sw.WriteLine($"WebSocket路径{TextBoxTrojanGoWSPath.Text}");
}
}
//生成Trojan客户端资料
private void GenerateTrojanShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("trojan_config");
while (Directory.Exists(@"trojan_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"trojan_config\" + saveFileFolder);
string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}#{TextBoxTrojanServerHost.Text}";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxURL.Text = trojanUrl;
using (StreamWriter sw = new StreamWriter($"trojan_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(trojanUrl);
}
CreateQRCode(trojanUrl, "trojan_config");
//移动Trojan官方程序配置文件到相应目录
if (File.Exists(@"trojan_config\config.json"))
{
File.Move(@"trojan_config\config.json", @"trojan_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"trojan_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为Trojan官方程序所使用的客户端配置文件配置为全局模式socks5地址127.0.0.1:1080");
sw.WriteLine("Trojan官方网站https://trojan-gfw.github.io/trojan/");
sw.WriteLine("Trojan官方程序下载地址https://github.com/trojan-gfw/trojan/releases");
sw.WriteLine("下载相应版本Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录运行trojan.exe即可。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("QR.bmp");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点");
sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)复制粘贴导入节点的网址");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxTrojanServerHost.Text}");
sw.WriteLine($"端口(Port){TextBoxTrojanServerPort.Text}");
sw.WriteLine($"密钥:{TextBoxTrojanServerPassword.Text}");
}
}
//生成NaiveProxy客户端资料
private void GenerateNaivePrxoyShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxNaiveServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("naive_config");
while (Directory.Exists(@"naive_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"naive_config\" + saveFileFolder);
string naiveUrl = $"https://{TextBoxNaiveUser.Text}:{TextBoxNaivePassword.Text}@{TextBoxNaiveServerHost.Text}:443/?name={TextBoxNaiveServerHost.Text}&extra_headers=";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxURL.Text = naiveUrl;
using (StreamWriter sw = new StreamWriter($"naive_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(naiveUrl);
}
//CreateQRCode(trojanUrl);
//移动NaiveProxy官方程序配置文件到相应目录
if (File.Exists(@"naive_config\config.json"))
{
File.Move(@"naive_config\config.json", @"naive_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"naive_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为NaiveProxy官方程序所使用的客户端配置文件配置为全局模式socks5地址127.0.0.1:1080");
sw.WriteLine("NaiveProxy官方网站https://github.com/klzgrad/naiveproxy");
sw.WriteLine("NaiveProxy官方程序下载地址https://github.com/klzgrad/naiveproxy/releases");
sw.WriteLine("下载相应版本Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录运行naive.exe即可。");
sw.WriteLine("-----------------------------------------\n");
//sw.WriteLine("其他平台的客户端,暂未发布");
//sw.WriteLine("QR.bmp");
//sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点");
//sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
//sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
//sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
//sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为NaiveGUI(windows)复制粘贴导入节点的网址");
sw.WriteLine("NaiveGUI(windows)下载网址https://github.com/ExcitedCodes/NaiveGUI/releases");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxNaiveServerHost.Text}");
sw.WriteLine($"用户名:{TextBoxNaiveUser.Text}");
sw.WriteLine($"密钥:{TextBoxNaivePassword.Text}");
}
}
//生成base64
private string ToBase64Encode(string text)
{
@ -406,8 +692,9 @@ namespace ProxySU
byte[] textBytes = Encoding.UTF8.GetBytes(text);
return Convert.ToBase64String(textBytes);
}
//生成QRcoder图片
private void CreateQRCode(string varBase64)
private void CreateQRCode(string varBase64,string configPath)
{
//string varBase64 = varBase64;
QRCodeGenerator qrGenerator = new QRCodeGenerator();
@ -418,9 +705,10 @@ namespace ProxySU
BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
ImageShareQRcode.Source = imgsource;
//DeleteObject(myImagePtr);
qrCodeImage.Save($"v2ray_config\\{saveFileFolder}\\QR.bmp");
qrCodeImage.Save($"{configPath}\\{saveFileFolder}\\QR.bmp");
//ImageShareQRcode.Source = @"config\v2rayN.bmp";
}
//判断目录是否存在,不存在则创建
private static bool CheckDir(string folder)
{
@ -436,11 +724,33 @@ namespace ProxySU
}
}
//打开文件夹
private void ButtonOpenSaveDir_Click(object sender, RoutedEventArgs e)
{
if (String.Equals(MainWindow.proxyType, "V2Ray"))
{
string openFolderPath = @"v2ray_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
else if (String.Equals(MainWindow.proxyType, "TrojanGo"))
{
string openFolderPath = @"trojan-go_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
else if (String.Equals(MainWindow.proxyType, "Trojan"))
{
string openFolderPath = @"trojan_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
else if (String.Equals(MainWindow.proxyType, "NaiveProxy"))
{
string openFolderPath = @"naive_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
}
}
}

View File

@ -1,72 +0,0 @@
<Window x:Class="ProxySU.TrojanGoResultClientInfoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="TrojanGoResultClientInfoWindow" Height="550" Width="400">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="0.2*"></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="服务器连接参数" Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="端口:" Grid.Column="0" Grid.Row="2"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPort" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密钥:" Grid.Column="0" Grid.Row="3"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
<TextBlock x:Name="TextBlockTrojanGoWebSocketPath" Text="WebSocket路径" Grid.Column="0" Grid.Row="4"></TextBlock>
<TextBox x:Name="TextBoxTrojanGoWSPath" Grid.Column="1" Grid.Row="4" Margin="4"></TextBox>
<TextBlock x:Name="TextBlockTrojanGoCaption" Grid.Column="2" Grid.Row="4"></TextBlock>
</Grid>
</GroupBox>
<GroupBox Header="二维码/URL" Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.4*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="可用于ShadowRocket (ios)、igniterAndroid、Trojan-QT5 (windows) 扫码和导入url" TextWrapping="Wrap" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"></TextBlock>
<Image x:Name="ImageTrojanShareQRurl" Grid.Column="0" Grid.Row="1"></Image>
<TextBox x:Name="TextBoxTrojanUrl" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1"></TextBox>
</Grid>
</GroupBox>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="ButtonTrojanResultOpen" Content="确定" Grid.Column="1" Margin="4" Click="ButtonTrojanResultOpen_Click"></Button>
</Grid>
</Grid>
</Grid>
</Window>

View File

@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
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
{
/// <summary>
/// TrojanGoResultClientInfoWindow.xaml 的交互逻辑
/// </summary>
public partial class TrojanGoResultClientInfoWindow : Window
{
private string saveFileFolder = "";
public TrojanGoResultClientInfoWindow()
{
InitializeComponent();
TextBoxTrojanGoWSPath.Visibility = Visibility.Hidden;
TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Hidden;
TextBlockTrojanGoCaption.Visibility = Visibility.Hidden;
//主机地址
TextBoxTrojanServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
//主机端口
TextBoxTrojanServerPort.Text = "443";
//密钥uuid
TextBoxTrojanServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
//WebSocket路径
if (MainWindow.ReceiveConfigurationParameters[0].Equals("TrojanGoWebSocketTLS2Web"))
{
TextBoxTrojanGoWSPath.Text = MainWindow.ReceiveConfigurationParameters[3];
TextBoxTrojanGoWSPath.Visibility = Visibility.Visible;
TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Visible;
TextBlockTrojanGoCaption.Visibility = Visibility.Visible;
}
GenerateV2rayShareQRcodeAndBase64Url();
}
private void GenerateV2rayShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("trojan-go_config");
while (Directory.Exists(@"trojan-go_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"trojan-go_config\" + saveFileFolder);
string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}?allowinsecure=0&tfo=0&sni=&mux=0&ws=0&group=#{TextBoxTrojanServerHost.Text}";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxTrojanUrl.Text = trojanUrl;
using (StreamWriter sw = new StreamWriter($"trojan-go_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(trojanUrl);
}
CreateQRCode(trojanUrl);
//移动Trojan官方程序配置文件到相应目录
if (File.Exists(@"trojan-go_config\config.json"))
{
File.Move(@"trojan-go_config\config.json", @"trojan-go_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"trojan-go_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为Trojan-go官方程序所使用的客户端配置文件配置为全局模式http与socks5地址127.0.0.1:1080");
sw.WriteLine("Trojan-go官方网站https://github.com/p4gefau1t/trojan-go");
sw.WriteLine("Trojan-go官方程序下载地址https://github.com/p4gefau1t/trojan-go/releases");
sw.WriteLine("下载相应版本Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录运行trojan.exe即可。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("QR.bmp");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点Trojan-Go的WebSocket模式暂不支持");
sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)复制粘贴导入节点的网址Trojan-Go的WebSocket模式暂不支持");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxTrojanServerHost.Text}");
sw.WriteLine($"端口(Port){TextBoxTrojanServerPort.Text}");
sw.WriteLine($"密钥:{TextBoxTrojanServerPassword.Text}");
sw.WriteLine($"WebSocket路径{TextBoxTrojanGoWSPath.Text}");
}
}
//生成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);
IntPtr myImagePtr = qrCodeImage.GetHbitmap();
BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
ImageTrojanShareQRurl.Source = imgsource;
//DeleteObject(myImagePtr);
qrCodeImage.Save($"trojan-go_config\\{saveFileFolder}\\QR.bmp");
}
//判断目录是否存在,不存在则创建
private static bool CheckDir(string folder)
{
try
{
if (!Directory.Exists(folder))//如果不存在就创建file文件夹
Directory.CreateDirectory(folder);//创建该文件夹  
return true;
}
catch (Exception)
{
return false;
}
}
private void ButtonTrojanResultOpen_Click(object sender, RoutedEventArgs e)
{
string openFolderPath = @"trojan-go_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
}
}

View File

@ -54,9 +54,9 @@
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonTrojanGoTLS2Web" Content="Trojan-Go+TLS+Web" Grid.Column="0" Grid.Row="1" Checked="RadioButtonTrojanTLS2Web_Checked"></RadioButton>
<TextBlock Text="说明" Grid.Column="1" Grid.Row="1"></TextBlock>
<TextBlock Text="http/2传输Caddy2伪装网站抗识别暂不支持CloudFlare的CDN" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"></TextBlock>
<RadioButton x:Name="RadioButtonTrojanGoWebSocketTLS2Web" Content="Trojan-Go+WebSocket+TLS+Web" Grid.Column="0" Grid.Row="2" Checked="RadioButtonTrojanGoWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="支持CDN" Grid.Column="1" Grid.Row="2"></TextBlock>
<TextBlock Text="使用WebSocket传输Caddy2伪装网站抗识别支持CloudFlare的CDN" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2"></TextBlock>
</Grid>
</GroupBox>
<GroupBox Header="其他设置" Grid.Row="1">

View File

@ -1,72 +0,0 @@
<Window x:Class="ProxySU.TrojanResultClientInfoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="TrojanResultClientInfoWindow" Height="550" Width="400">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="0.2*"></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="服务器连接参数" Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="服务器地址:" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerHost" Grid.Column="1" Grid.Row="1" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="端口:" Grid.Column="0" Grid.Row="2"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPort" Grid.Column="1" Grid.Row="2" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="密钥:" Grid.Column="0" Grid.Row="3"></TextBlock>
<TextBox x:Name="TextBoxTrojanServerPassword" Grid.Column="1" Grid.Row="3" Margin="4"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3"></TextBlock>
<!--<TextBlock x:Name="TextBlockTrojanGoWebSocketPath" Text="WebSocket路径" Grid.Column="0" Grid.Row="4"></TextBlock>
<TextBox x:Name="TextBoxTrojanGoWSPath" Grid.Column="1" Grid.Row="4" Margin="4"></TextBox>
<TextBlock x:Name="TextBlockTrojanGoCaption" Grid.Column="2" Grid.Row="4"></TextBlock>-->
</Grid>
</GroupBox>
<GroupBox Header="二维码/URL" Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.4*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="可用于ShadowRocket (ios)、igniterAndroid、Trojan-QT5 (windows) 扫码和导入url" TextWrapping="Wrap" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"></TextBlock>
<Image x:Name="ImageTrojanShareQRurl" Grid.Column="0" Grid.Row="1"></Image>
<TextBox x:Name="TextBoxTrojanUrl" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1"></TextBox>
</Grid>
</GroupBox>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="ButtonTrojanResultOpen" Content="确定" Grid.Column="1" Margin="4" Click="ButtonTrojanResultOpen_Click"></Button>
</Grid>
</Grid>
</Grid>
</Window>

View File

@ -1,163 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
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
{
/// <summary>
/// TrojanResultClientInfoWindow.xaml 的交互逻辑
/// </summary>
public partial class TrojanResultClientInfoWindow : Window
{
private string saveFileFolder = "";
public TrojanResultClientInfoWindow()
{
InitializeComponent();
//TextBoxTrojanGoWSPath.Visibility = Visibility.Hidden;
//TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Hidden;
//TextBlockTrojanGoCaption.Visibility = Visibility.Hidden;
//主机地址
TextBoxTrojanServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
//主机端口
TextBoxTrojanServerPort.Text = "443";
//密钥uuid
TextBoxTrojanServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
//WebSocket路径
//if (MainWindow.ReceiveConfigurationParameters[0].Equals("TrojanGoWebSocketTLS2Web"))
//{
// TextBoxTrojanGoWSPath.Text = MainWindow.ReceiveConfigurationParameters[3];
// TextBoxTrojanGoWSPath.Visibility = Visibility.Visible;
// TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Visible;
// TextBlockTrojanGoCaption.Visibility = Visibility.Visible;
//}
GenerateV2rayShareQRcodeAndBase64Url();
}
//生成Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)客户端导入文件
private void GenerateV2rayShareQRcodeAndBase64Url()
{
string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
int num = 1;
saveFileFolder = saveFileFolderFirst;
CheckDir("trojan_config");
while (Directory.Exists(@"trojan_config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"trojan_config\" + saveFileFolder);
string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}#{TextBoxTrojanServerHost.Text}";
//MessageBox.Show(v2rayNjsonObject.ToString());
//string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxTrojanUrl.Text = trojanUrl;
using (StreamWriter sw = new StreamWriter($"trojan_config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(trojanUrl);
}
CreateQRCode(trojanUrl);
//移动Trojan官方程序配置文件到相应目录
if (File.Exists(@"trojan_config\config.json"))
{
File.Move(@"trojan_config\config.json", @"trojan_config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"trojan_config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为Trojan官方程序所使用的客户端配置文件配置为全局模式socks5地址127.0.0.1:1080");
sw.WriteLine("Trojan官方网站https://trojan-gfw.github.io/trojan/");
sw.WriteLine("Trojan官方程序下载地址https://github.com/trojan-gfw/trojan/releases");
sw.WriteLine("下载相应版本Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录运行trojan.exe即可。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("QR.bmp");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)扫码导入节点");
sw.WriteLine("Trojan-QT5 (windows)下载网址https://github.com/TheWanderingCoel/Trojan-Qt5/releases");
sw.WriteLine("igniterAndroid下载网址https://github.com/trojan-gfw/igniter/releases");
sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为Trojan-QT5 (windows)、igniterAndroid、Shadowrocket(ios)复制粘贴导入节点的网址");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxTrojanServerHost.Text}");
sw.WriteLine($"端口(Port){TextBoxTrojanServerPort.Text}");
sw.WriteLine($"密钥:{TextBoxTrojanServerPassword.Text}");
}
}
//生成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);
IntPtr myImagePtr = qrCodeImage.GetHbitmap();
BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
ImageTrojanShareQRurl.Source = imgsource;
//DeleteObject(myImagePtr);
qrCodeImage.Save($"trojan_config\\{saveFileFolder}\\QR.bmp");
}
//判断目录是否存在,不存在则创建
private static bool CheckDir(string folder)
{
try
{
if (!Directory.Exists(folder))//如果不存在就创建file文件夹
Directory.CreateDirectory(folder);//创建该文件夹  
return true;
}
catch (Exception)
{
return false;
}
}
private void ButtonTrojanResultOpen_Click(object sender, RoutedEventArgs e)
{
string openFolderPath = @"trojan_config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
}
}

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="TemplateConfiguration" Height="600" Width="850">
Title="V2RayTemplateConfiguration" Height="600" Width="850">
<Window.Resources>
<Style BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox"
@ -61,9 +61,9 @@
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonWebSocketTLS2WebHot" Content="WebSocket+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="稳定性强,使用Caddy做前置隐藏代理被识别为访问网站的https流量抗封锁识别最强。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="稳定性强Caddy2做前置,隐藏代理特征被识别为访问网站的https流量抗封锁识别最强,需要域名,支持CDN" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonHTTP2WebHot" Content="HTTP2+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 传输方式完整按 HTTP/2 标准实现,使用Caddy做前置需要域名" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="基于 HTTP/2 传输。完整按 HTTP/2 标准实现Caddy2做前置,隐藏代理特征H2C协议转发到V2Ray需要域名暂不支持CloudFlare的CDN" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
</Grid>
</TabItem>
@ -90,10 +90,12 @@
<RadioButton x:Name="RadioButtonTCPhttp" Content="TCP+Http伪装" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonTCPhttp_Checked" ></RadioButton>
<TextBlock Text="数据加密传输并做http伪装会被识别为http流量但并不是真正的http访问" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonTCP2TLS" Content="TCP+TLS" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonTCP2TLS_Checked" />
<TextBlock Text="数据加密传输传输协议使用TLS会被识别为TLS流量不等同于https流量特征 (需域名)" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="数据加密传输传输协议使用TLS会被识别为TLS流量不等同于https流量特征 (需域名)" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonTcpTLS2SelfSigned" Content="TCP+TLS((自签证书)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="4" Checked="RadioButtonTCP2TLSnoDomain_Checked" />
<TextBlock Text="数据加密传输传输协议使用TLS会被识别为TLS流量不等同于https流量特征 (无需域名)" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="Shadowrocket (ios)需要手动打开“允许不安全”选项" TextWrapping="Wrap" Grid.Column="4" Grid.Row="4" ></TextBlock>
<RadioButton x:Name="RadioButtonVlessTcpTlsWeb" Content="VLESS+TCP+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="5" Checked="RadioButtonTCP2TLS_Checked" ></RadioButton>
<TextBlock Text="轻量协议VLESS,占用更少主机资源数据TLS加密传输用Caddy2在节点上做伪装网站。适合配置低的VPS,或多人共用节点服务端客户端版本要求4.27+ (需域名)," TextWrapping="Wrap" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3"></TextBlock>
</Grid>
</TabItem>
@ -120,7 +122,7 @@
<RadioButton x:Name="RadioButtonWebSocketTLS" Content="WebSocket+TLS" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonHTTP2_Checked"/>
<TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLS2Web" Content="WebSocket+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="稳定性强,使用使用Caddy做前置隐藏代理被识别为访问网站的https流量抗封锁识别最强。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="稳定性强Caddy2做前置,隐藏代理特征被识别为访问网站的https流量抗封锁识别最强,需要域名,支持CDN" TextWrapping="Wrap" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLSselfSigned" Content="WebSocket+TLS(自签证书)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="4" Checked="RadioButtonWebSocketTLSselfSigned_Checked"></RadioButton>
<TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(无需域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="Shadowrocket (ios)需要手动打开“允许不安全”选项" TextWrapping="Wrap" Grid.Column="4" Grid.Row="4" ></TextBlock>
@ -148,9 +150,9 @@
<RadioButton x:Name="RadioButtonHTTP2" Content="HTTP2" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonHTTP2_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,需要域名" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonHTTP2Web" Content="HTTP2+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 传输方式完整按 HTTP/2 标准实现,使用Caddy做前置需要域名" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="基于 HTTP/2 传输。完整按 HTTP/2 标准实现Caddy2做前置,隐藏代理特征H2C协议转发到V2Ray需要域名暂不支持CloudFlare的CDN" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonHTTP2selfSigned" Content="HTTP2(自签证书)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonWebSocketTLSselfSigned_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,可以不需要域名。" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,使用自签名证书,不需要域名" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="Shadowrocket (ios)需要手动打开“允许不安全”选项" TextWrapping="Wrap" Grid.Column="4" Grid.Row="3" ></TextBlock>
</Grid>
@ -176,7 +178,7 @@
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonMkcpNone" Content="mKCP(无伪装)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="数据加密传输,以增加流量消耗来加速减少延迟udp协议,无伪装会被识别为udp流量" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="数据加密传输,以增加带宽占用减少延迟udp协议,无伪装会被识别为udp流量" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2SRTP" Content="mKCP+SRTP" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCPuTP" Content="mKCP+uTP" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonQuicNone_Checked"></RadioButton>
@ -252,6 +254,7 @@
<TextBlock x:Name="TextBlockServerListenPort" Text="服务端口:" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1"></TextBlock>
<TextBox x:Name="TextBoxServerListenPort" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonServerListenPort" Content="随机选择" Grid.Column="4" Grid.Row="0" Margin="2" Click="ButtonServerListenPort_Click"></Button>
<TextBlock Text="若使用TLS加密请保持默认的443端口" Grid.Column="5" Grid.ColumnSpan="2" Grid.Row="0" Margin="3"></TextBlock>
<TextBlock x:Name="TextBlockNewUUID" Text="UUID" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="1"></TextBlock>
<TextBox x:Name="TextBoxNewUUID" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonNewUUID" Content="更新" Grid.Column="4" Grid.Row="1" Margin="2" Click="ButtonNewUUID_Click"></Button>
@ -259,7 +262,7 @@
<TextBlock x:Name="TextBlockQuicUUID" Text="mKCP/QUIC密钥" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="1"></TextBlock>
<TextBox x:Name="TextBoxQuicUUID" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonQuicUUID" Content="更新" Grid.Column="4" Grid.Row="2" Margin="2" Click="ButtonQuicUUID_Click"></Button>
<TextBlock x:Name="TextBlockMkcpUUID" Text="启用mKCP密钥可增强抗识别删除留空则禁用,要求版本4.24.2以上" TextWrapping="Wrap" Grid.Column="5" Grid.Row="2" Grid.ColumnSpan="2"></TextBlock>
<TextBlock x:Name="TextBlockMkcpUUID" Text="启用mKCP密钥可增强抗识别留空则禁用,要求版本4.24.2以上,V2rayN暂不支持" TextWrapping="Wrap" Grid.Column="5" Grid.Row="2" Grid.ColumnSpan="2"></TextBlock>
<TextBlock x:Name="TextBlockPath" Text="路径:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="1"></TextBlock>
<TextBox x:Name="TextBoxPath" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3" Margin="3"></TextBox>

View File

@ -88,6 +88,37 @@ namespace ProxySU
// MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
}
//VLESS+TCP+TLS+Caddy模式选中
else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
{
if (string.IsNullOrEmpty(TextBoxDomain.Text.ToString()) == true)
{
MessageBox.Show("域名不能为空!");
return;
}
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
//传递域名
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
//传递伪装网站
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString();
//处理伪装网站域名中的前缀
DisguiseURLprocessing();
//if (TextBoxMaskSites.Text.ToString().Length >= 7)
//{
// string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
// if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
// {
// //MessageBox.Show(testDomain);
// MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
// }
// else
// {
// MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
// }
//}
}
//webSocket模式被选中
else if (RadioButtonWebSocket.IsChecked == true)
{
@ -129,19 +160,20 @@ namespace ProxySU
//传递伪装网站
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString();
//处理伪装网站域名中的前缀
if (TextBoxMaskSites.Text.ToString().Length >= 7)
{
string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
{
//MessageBox.Show(testDomain);
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
}
else
{
MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
}
}
DisguiseURLprocessing();
//if (TextBoxMaskSites.Text.ToString().Length >= 7)
//{
// string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
// if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
// {
// //MessageBox.Show(testDomain);
// MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
// }
// else
// {
// MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
// }
//}
}
//WebSocket+TLS(自签证书)模式被选中
else if (RadioButtonWebSocketTLSselfSigned.IsChecked == true)
@ -187,19 +219,20 @@ namespace ProxySU
//传递伪装网站
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString();
//处理伪装网站域名中的前缀
if (TextBoxMaskSites.Text.ToString().Length >= 7)
{
string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
{
//MessageBox.Show(testDomain);
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
}
else
{
MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
}
}
DisguiseURLprocessing();
//if (TextBoxMaskSites.Text.ToString().Length >= 7)
//{
// string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
// if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
// {
// //MessageBox.Show(testDomain);
// MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
// }
// else
// {
// MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
// }
//}
}
//http2(自签证书)模式被选中
else if (RadioButtonHTTP2selfSigned.IsChecked == true)
@ -342,6 +375,25 @@ namespace ProxySU
private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
//伪装网站处理
private void DisguiseURLprocessing()
{
//处理伪装网站域名中的前缀
if (TextBoxMaskSites.Text.ToString().Length >= 7)
{
string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
{
//MessageBox.Show(testDomain);
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
}
else
{
MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
}
}
}
#region
private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
{

Binary file not shown.

View File

@ -0,0 +1,43 @@
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
}
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": null,
"port": 443,
"users": [
{
"id": null,
"encryption": "none",
"level": 0
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls"
}
}
]
}

View File

@ -0,0 +1,42 @@
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": null
}
],
"decryption": "none",
"fallback": {
"port": 88
}
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"http/1.1"
],
"certificates": [
{
"certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
"keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
}
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}