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

优化伪装网址预处理并提醒伪装网址格式

This commit is contained in:
ProxySU 2020-11-06 10:26:07 +08:00
parent 01af863260
commit ca451b391b
13 changed files with 192 additions and 95 deletions

View File

@ -2,26 +2,81 @@
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.Navigation;
using System.Windows.Shapes;
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;
using System.Drawing;
using QRCoder;
using System.Net;
using System.ComponentModel;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Runtime;
using System.Globalization;
using Microsoft.Win32;
using System.Security;
namespace ProxySU
{
class ClassModel
{
//检测域名是否为空
public static bool TestDomainIsEmpty(string domainStr)
{
domainStr = domainStr.Trim();
if (string.IsNullOrEmpty(domainStr) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return false;
}
else
{
return true;
}
}
//伪装网站预处理
public static bool PreDomainMask(string uri)
{
uri = uri.Trim();
if (String.IsNullOrEmpty(uri) == false)
{
if (uri.Contains("/") == true)
{
//MessageBox.Show("伪装网址输入格式错误!请重新输入!");
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_MaskSitesToolTip").ToString());
return false;
}
}
return true;
}
//伪装网址的处理
public static string DisguiseURLprocessing(string fakeUrl)
{
var uri = new Uri(fakeUrl);
return uri.Host;
//Console.WriteLine(uri.Host);
////处理伪装网站域名中的前缀
fakeUrl = fakeUrl.Trim();
return fakeUrl;
//处理伪装网站域名中的前缀
//if (fakeUrl.Length >= 7)
//{
// string testDomainMask = fakeUrl.Substring(0, 7);
// if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
// {
// string[] tmpUrl = fakeUrl.Split('/');
// fakeUrl = tmpUrl[2];
// var uri = new Uri(fakeUrl);
// return uri.Host;
// }
//}

View File

@ -355,7 +355,7 @@
<Button x:Name="ButtonTrojanPassword" Content="{DynamicResource ButtonTrojanChangePassword}" Grid.Column="2" Grid.Row="2" Margin="2" Click="ButtonTrojanPassword_Click" ></Button>
<TextBlock Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" ></TextBlock>
<TextBox x:Name="TextBoxTrojanSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="3" Margin="3"></TextBox>
<TextBox x:Name="TextBoxTrojanSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="3" Margin="3"></TextBox>
</Grid>
</GroupBox>
@ -408,7 +408,7 @@
<TextBox x:Name="TextBoxNaivePassword" Grid.Column="1" Grid.Row="3" Margin="3"></TextBox>
<Button x:Name="ButtonNaivePassword" Content="{DynamicResource ButtonTrojanChangePassword}" Grid.Column="2" Grid.Row="3" Margin="2" Click="ButtonNaivePassword_Click"></Button>
<TextBlock Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxNaiveSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="4" Margin="3"></TextBox>
<TextBox x:Name="TextBoxNaiveSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="4" Margin="3"></TextBox>
</Grid>
</GroupBox>
@ -461,7 +461,7 @@
<Button x:Name="ButtonSSRPassword" Content="{DynamicResource ButtonTrojanChangePassword}" Grid.Column="2" Grid.Row="2" Margin="2" Click="ButtonSSRPassword_Click" ></Button>
<TextBlock Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxSSRSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="3" Margin="3"></TextBox>
<TextBox x:Name="TextBoxSSRSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="3" Margin="3"></TextBox>
</Grid>
</GroupBox>
@ -564,7 +564,7 @@
<Button x:Name="ButtonMtgPassword" Content="{DynamicResource ButtonTrojanChangePassword}" Grid.Column="2" Grid.Row="2" Margin="2" Click="ButtonSSRPassword_Click" ></Button>-->
<TextBlock Text="{DynamicResource TextBlockMtgFakeDomainExplanation}" Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox x:Name="TextBoxMtgSites" Style="{StaticResource TitleText}" Tag="azure.microsoft.com" Grid.Column="1" Grid.Row="3" Margin="3" ></TextBox>
<TextBox x:Name="TextBoxMtgSites" Style="{StaticResource TitleText}" Tag="azure.microsoft.com" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="3" Margin="3" ></TextBox>
<TextBlock Text="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="2" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>
<TextBlock Text="TAG" Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Visibility="Collapsed"></TextBlock>
@ -671,7 +671,7 @@
<Button x:Name="ButtonEnableRootPassWord" Content="{DynamicResource ButtonEnableRootPassWord}" Grid.Column="0" Grid.Row="1" Margin="5" Click="ButtonEnableRootPassWord_Click"></Button>
<Button x:Name="ButtonEnableRootCert" Content="{DynamicResource ButtonEnableRootCert}" Grid.Column="1" Grid.Row="1" Margin="5" Click="ButtonEnableRootCert_Click"></Button>
<Button x:Name="ButtonRootProhibitsPasswordLogin" Content="{DynamicResource ButtonRootProhibitsPasswordLogin}" Grid.Column="2" Grid.Row="1" Margin="5" Click="ButtonRootProhibitsPasswordLogin_Click"></Button>
<Button Content="test" Grid.Column="3" Grid.Row="2" Margin="10" Click="Button_Click" Visibility="Collapsed"></Button>
<Button Content="test" Grid.Column="3" Grid.Row="2" Margin="10" Click="Button_Click" Visibility="Visible"></Button>
</Grid>
</TabItem>

View File

@ -779,7 +779,7 @@ namespace ProxySU
TextBlockCurrentlySelectedPlanPort.Text = ReceiveConfigurationParameters[1]; //服务器端口
TextBlockCurrentlySelectedPlanUUID.Text = ReceiveConfigurationParameters[2]; //UUID
TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
//MessageBox.Show(ReceiveConfigurationParameters[7]);
TextBlockCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
@ -2979,10 +2979,16 @@ namespace ProxySU
{
ReceiveConfigurationParameters[i] = "";
}
if (string.IsNullOrEmpty(PreTrim(TextBoxTrojanHostDomain.Text)) == true)
bool preDomainMask = ClassModel.PreDomainMask(TextBoxTrojanSites.Text);
bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxTrojanHostDomain.Text);
//if (string.IsNullOrEmpty(PreTrim(TextBoxTrojanHostDomain.Text)) == true)
//{
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return;
//}
if (domainNotEmpty == false || preDomainMask == false)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return;
}
//传递模板类型
@ -3540,12 +3546,12 @@ namespace ProxySU
//NaiveProxy一键安装开始传递参数
private void ButtonNavieSetUp_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(PreTrim(TextBoxNaiveHostDomain.Text)) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return;
}
//if (string.IsNullOrEmpty(PreTrim(TextBoxNaiveHostDomain.Text)) == true)
//{
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return;
//}
ConnectionInfo connectionInfo = GenerateConnectionInfo();
if (connectionInfo == null)
@ -3554,7 +3560,19 @@ namespace ProxySU
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
return;
}
//清空参数空间
for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
{
ReceiveConfigurationParameters[i] = "";
}
bool preDomainMask = ClassModel.PreDomainMask(TextBoxNaiveSites.Text);
bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxNaiveHostDomain.Text);
if (domainNotEmpty == false || preDomainMask == false)
{
return;
}
//传递参数
ReceiveConfigurationParameters[4] = PreTrim(TextBoxNaiveHostDomain.Text);//传递域名
ReceiveConfigurationParameters[1] = "443";//传递端口
@ -3937,12 +3955,19 @@ namespace ProxySU
{
ReceiveConfigurationParameters[i] = "";
}
if (string.IsNullOrEmpty(PreTrim(TextBoxSSRHostDomain.Text)) == true)
bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxSSRHostDomain.Text);
bool preDomainMask = ClassModel.PreDomainMask(TextBoxSSRSites.Text);
if (domainNotEmpty == false || preDomainMask == false)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return;
}
//if (string.IsNullOrEmpty(PreTrim(TextBoxSSRHostDomain.Text)) == true)
//{
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return;
//}
//传递域名
ReceiveConfigurationParameters[4] = PreTrim(TextBoxSSRHostDomain.Text);
@ -7257,9 +7282,11 @@ namespace ProxySU
#region
private void Button_Click(object sender, RoutedEventArgs e)
{
saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
string host = ClassModel.DisguiseURLprocessing("www.google.com/accout/");
MessageBox.Show(host);
//saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
//saveShellScriptFileName = "tmp." + saveShellScriptFileName + ".sh";
MessageBox.Show(saveShellScriptFileName);
//MessageBox.Show(saveShellScriptFileName);
//var rand = System.Security.Cryptography.RandomNumberGenerator.Create();
//byte[] bytes = new byte[8];
//rand.GetBytes(bytes);

View File

@ -266,7 +266,7 @@
<Button x:Name="ButtonDomain" Content="检测" Visibility="Collapsed" Grid.Column="4" Grid.Row="4" Margin="2" ></Button>
<TextBlock x:Name="TextBlockMaskSites" Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="1" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" Margin="3"></TextBox>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtondDecide" Content="{DynamicResource ButtonTrojanGoTemplateOK}" Grid.Column="1" Grid.Row="6" Margin="0" Click="ButtondDecide_Click"></Button>

View File

@ -92,7 +92,8 @@ namespace ProxySU
private void ButtondDecide_Click(object sender, RoutedEventArgs e)
{
bool testDomain = true;
bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
bool domainNotEmpty = true;
//UncheckLayouts(TabControlTemplate);
//SS 经典模式被选中
if (RadioButtonNonePluginSS.IsChecked == true)
@ -116,7 +117,7 @@ namespace ProxySU
else if (RadioButtonObfsPluginHttpsWebSS.IsChecked == true)
{
testDomain = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "ObfsPluginHttpsWebSS";
//传递方案名称
@ -142,7 +143,7 @@ namespace ProxySU
//V2Ray-Plugin SS+WebSocket+TLS+Web模式被选中
else if (RadioButtonWebSocketTLSWebFrontSS.IsChecked == true || RadioButtonWebSocketTLSWebFrontSSHot.IsChecked == true)
{
testDomain = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSWebFrontSS";
//传递方案名称
@ -159,7 +160,7 @@ namespace ProxySU
//V2Ray-Plugin SS+QUIC模式被选中
else if (RadioButtonQuicSS.IsChecked == true)
{
testDomain = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicSS";
//传递方案名称
@ -181,7 +182,7 @@ namespace ProxySU
//SS+GoQuiet-Plugin模式被选中
else if (RadioButtonGoQuietPluginSS.IsChecked == true)
{
testDomain = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "GoQuietPluginSS";
//传递方案名称
@ -193,7 +194,7 @@ namespace ProxySU
//SS+Cloak-Plugin模式被选中
else if (RadioButtonCloakPluginSS.IsChecked == true)
{
testDomain = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "CloakPluginSS";
//传递方案名称
@ -210,11 +211,11 @@ namespace ProxySU
//传递加密方式
MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
if (testDomain)
if (domainNotEmpty == true && preDomainMask == true)
{
this.Close();
}
}
private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
@ -376,18 +377,18 @@ namespace ProxySU
}
//域名检测是否为空
private bool TestDomainIsEmpty()
{
if (string.IsNullOrEmpty(PreTrim(TextBoxDomainSS.Text)) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return false;
}
else
{
return true;
}
}
//private bool TestDomainIsEmpty()
//{
// if (string.IsNullOrEmpty(PreTrim(TextBoxDomainSS.Text)) == true)
// {
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return false;
// }
// else
// {
// return true;
// }
//}
}
}

View File

@ -175,6 +175,8 @@
<sys:String x:Key="TextBlockV2RayDomain">Domain name:</sys:String>
<sys:String x:Key="TextBlockV2RayMaskSites">Mask a website:</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesTag">Set this option to increase proxy concealment (can be empty)</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesToolTip">Enter only the domain name, excluding "http" and "/" etc.</sys:String>
<sys:String x:Key="MessageBoxShow_MaskSitesToolTip">The input format of the fake URL is wrong! please enter again!</sys:String>
<sys:String x:Key="TextBlockV2RayWebSocketTlsWebExplain">Strong stability, Caddy2 as the front, hidden proxy feature, recognized as https traffic to the website, the strongest anti-blocking recognition, domain name is required, CDN support</sys:String >
<sys:String x:Key="TextBlockV2RayHttp2TlsWebExplain">based on HTTP/2 transmission. Completely implemented in accordance with the HTTP/2 standard, with Caddy2 as the front, hidden proxy features, H2C protocol forwarding to V2Ray, domain name is required, and CloudFlare CDN is not currently supported</sys:String>
<sys:String x:Key="TextBlockVlessVmessXtlsTcpWebSocketExplainHot">VLESS over TCP with XTLS + fallback and shunt to WHATEVER (ultimate configuration), configured and recommended by rprx boss (author of xtls), configure the following five solutions at the same time on the server side, sharing the same domain name and port 443, WS can pass through CDN.</sys:String>

View File

@ -178,6 +178,8 @@
<sys:String x:Key="TextBlockV2RayDomain">域名:</sys:String>
<sys:String x:Key="TextBlockV2RayMaskSites">伪装网站:</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesTag">设置此项可增加代理的隐蔽(可为空)</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesToolTip">仅仅输入域名,不包括"http"及"/"等</sys:String>
<sys:String x:Key="MessageBoxShow_MaskSitesToolTip">伪装网址输入格式错误!请重新输入!</sys:String>
<sys:String x:Key="TextBlockV2RayWebSocketTlsWebExplain">稳定性强Caddy2做前置隐藏代理特征被识别为访问网站的https流量抗封锁识别最强,需要域名,支持CDN</sys:String>
<sys:String x:Key="TextBlockV2RayHttp2TlsWebExplain">基于 HTTP/2 传输。完整按 HTTP/2 标准实现Caddy2做前置隐藏代理特征H2C协议转发到V2Ray需要域名暂不支持CloudFlare的CDN</sys:String>
<sys:String x:Key="TextBlockVlessVmessXtlsTcpWebSocketExplainHot">VLESS over TCP with XTLS + 回落 and 分流 to WHATEVER终极配置由rprx大佬 (xtls作者) 配置并推荐在服务端同时配置以下五种方案共用同一域名与443端口其中 WS 都可以通过 CDN。</sys:String>

View File

@ -175,6 +175,8 @@
<sys:String x:Key="TextBlockV2RayDomain">域名:</sys:String>
<sys:String x:Key="TextBlockV2RayMaskSites">偽裝網站:</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesTag">設置此項可增加代理的隱蔽(可為空)</sys:String>
<sys:String x:Key="TextBoxV2RayMaskSitesToolTip">僅僅輸入域名,不包括"http"及"/"等</sys:String>
<sys:String x:Key="MessageBoxShow_MaskSitesToolTip">偽裝網址輸入格式錯誤!請重新輸入!</sys:String>
<sys:String x:Key="TextBlockV2RayWebSocketTlsWebExplain">穩定性強Caddy2做前置隱藏代理特徵被識別為訪問網站的https流量抗封鎖識別最強,需要域名,支持CDN</sys:String >
<sys:String x:Key="TextBlockV2RayHttp2TlsWebExplain">基於 HTTP/2 傳輸。完整按 HTTP/2 標準實現Caddy2做前置隱藏代理特徵H2C協議轉發到V2Ray需要域名暫不支持CloudFlare的CDN</sys:String>
<sys:String x:Key="TextBlockVlessVmessXtlsTcpWebSocketExplainHot">VLESS over TCP with XTLS + 回落and 分流to WHATEVER終極配置由rprx大佬(xtls作者)配置並推薦在服務端同時配置以下五種方案共用同一域名與443端口其中 WS 都可以通過 CDN。</sys:String>

View File

@ -110,7 +110,7 @@
<TextBlock x:Name="TextBlockExplainCheckBoxMuxSelect" Text="{DynamicResource TextBlockExplainCheckBoxMuxSelect}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="2" Grid.RowSpan="2"></TextBlock>
<TextBlock x:Name="TextBlockMaskSites" Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="4" Margin="5"></TextBox>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="4" Margin="5"></TextBox>
<Grid Grid.Column="0" Grid.Row="6" Grid.ColumnSpan="4">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>

View File

@ -28,12 +28,15 @@ namespace ProxySU
}
private void ButtondDecide_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return;
}
bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
//{
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return;
//}
//传递域名
MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
//传递伪装网站
@ -67,7 +70,11 @@ namespace ProxySU
MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxConcurrency.Text);
MainWindow.ReceiveConfigurationParameters[5] = PreTrim(TextBoxIdle_timeout.Text);
}
this.Close();
if (domainNotEmpty == true && preDomainMask == true)
{
this.Close();
}
}
//更新密码
private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
@ -134,19 +141,19 @@ namespace ProxySU
return path;
}
//域名检测是否为空
private bool TestDomainIsEmpty()
{
if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return false;
}
else
{
return true;
}
}
//private bool TestDomainIsEmpty()
//{
// if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
// {
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return false;
// }
// else
// {
// return true;
// }
//}
private void CheckBoxMuxSelect_Checked(object sender, RoutedEventArgs e)
{

View File

@ -373,7 +373,7 @@
<TextBox x:Name="TextBoxDomain" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxDomainPrompt}" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonDomain" Content="检测" Visibility="Collapsed" Grid.Column="4" Grid.Row="4" Margin="2" Click="ButtonDomain_Click"></Button>
<TextBlock x:Name="TextBlockMaskSites" Text="{DynamicResource TextBlockV2RayMaskSites}" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="1" HorizontalAlignment="Right" VerticalAlignment="Center" ></TextBlock>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" Margin="3" ></TextBox>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="{DynamicResource TextBoxV2RayMaskSitesTag}" ToolTip="{DynamicResource TextBoxV2RayMaskSitesToolTip}" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" Margin="3" ></TextBox>
<Button x:Name="ButtondDecide" Content="{DynamicResource ButtonTrojanGoTemplateOK}" Grid.Column="1" Grid.Row="6" Margin="0" Click="ButtondDecide_Click"></Button>

View File

@ -74,6 +74,7 @@ namespace ProxySU
//传递所选择的参数与模板方案
private void ButtondDecide_Click(object sender, RoutedEventArgs e)
{
bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
bool domainNotEmpty = true;
#region TCP (VMESS)
@ -103,7 +104,7 @@ namespace ProxySU
//TCP+TLS模式被选中
else if (RadioButtonTCP2TLS.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "tcpTLS";
@ -135,7 +136,7 @@ namespace ProxySU
//VLESS+TCP+XTLS+Web模式选中
else if (RadioButtonVlessXtlsTcp.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessXtlsTcp";
@ -152,7 +153,7 @@ namespace ProxySU
//VLESS+TCP+TLS+Web模式选中
else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
@ -169,7 +170,7 @@ namespace ProxySU
//VLESS+WebSocket+TLS+Web模式选中
else if (RadioButtonVlessWebSocketTlsWeb.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessWebSocketTlsWeb";
@ -187,7 +188,7 @@ namespace ProxySU
//VLESS+http2+TLS+Web模式选中
else if (RadioButtonVlessHttp2Web.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessHttp2Web";
@ -205,7 +206,7 @@ namespace ProxySU
//VLESS+VMESS+XTLS+TCP+WebSocket+Web模式被选中
else if (RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "VlessVmessXtlsTcpWebSocketWeb";
//传递方案名称
@ -241,7 +242,7 @@ namespace ProxySU
//WebSocket+TLS模式被选中
else if (RadioButtonWebSocketTLS.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS";
@ -257,7 +258,7 @@ namespace ProxySU
//WebSocket+TLS+Web模式被选中
else if (RadioButtonWebSocketTLS2Web.IsChecked == true|| RadioButtonWebSocketTLS2WebHot.IsChecked==true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
@ -295,7 +296,7 @@ namespace ProxySU
//http2模式被选中
else if (RadioButtonHTTP2.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "Http2";
@ -312,7 +313,7 @@ namespace ProxySU
//http2+TLS+Web模式被选中
else if (RadioButtonHTTP2Web.IsChecked == true || RadioButtonHTTP2WebHot.IsChecked == true)
{
domainNotEmpty = TestDomainIsEmpty();
domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
@ -553,7 +554,7 @@ namespace ProxySU
MainWindow.mKCPvlessIsSet = false;
}
if (domainNotEmpty)
if (domainNotEmpty == true && preDomainMask == true)
{
this.Close();
}
@ -1085,19 +1086,19 @@ namespace ProxySU
return path;
}
//域名检测是否为空
private bool TestDomainIsEmpty()
{
if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
{
//****** "域名不能为空,请检查相关参数设置!" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
return false;
}
else
{
return true;
}
}
//private bool TestDomainIsEmpty()
//{
// if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
// {
// //****** "域名不能为空,请检查相关参数设置!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
// return false;
// }
// else
// {
// return true;
// }
//}
//加密方法更改后的动作
private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)

Binary file not shown.