1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

release v3.1.1

fix acme issue
This commit is contained in:
nuxt-autumn 2021-04-05 10:22:43 +08:00
parent f27ae4d70c
commit dc38de67d5
15 changed files with 178 additions and 43 deletions

View File

@ -25,20 +25,18 @@ namespace ProxySU_Core.Models.Developers
private const string ServerReverseDir = @"Templates\xray\server\09_reverse";
private const string CaddyFileDir = @"Templates\xray\caddy";
public const int VLESS_TCP_Port = 1110;
public const int VLESS_WS_Port = 1111;
public const int VLESS_H2_Port = 1112;
public const int VLESS_mKCP_Port = 1113;
public static int VLESS_TCP_Port = 1110;
public static int VLESS_WS_Port = 1111;
public static int VLESS_H2_Port = 1112;
public static int VLESS_mKCP_Port = 1113;
public const int VMESS_TCP_Port = 2110;
public const int VMESS_WS_Port = 2111;
public const int VMESS_H2_Port = 2112;
public const int VMESS_mKCP_Port = 2113;
public static int VMESS_TCP_Port = 1210;
public static int VMESS_WS_Port = 1211;
public static int VMESS_H2_Port = 1212;
public const int Trojan_TCP_Port = 3110;
public const int Trojan_WS_Port = 3111;
public static int Trojan_TCP_Port = 1310;
public static int Trojan_WS_Port = 1311;
public const int ShadowSocksPort = 4110;
public static dynamic LoadXrayConfig()
@ -73,6 +71,16 @@ namespace ProxySU_Core.Models.Developers
{
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
if (parameters.Port != 443)
{
caddyStr = caddyStr.Replace(":##port##", "");
}
else
{
caddyStr = caddyStr.Replace("##port##", 80.ToString());
}
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
{
var prefix = "http://";
@ -167,7 +175,7 @@ namespace ProxySU_Core.Models.Developers
if (parameters.Types.Contains(XrayType.VMESS_KCP))
{
var kcpBound = GetBound("VMESS_KCP.json");
kcpBound.port = VMESS_mKCP_Port;
kcpBound.port = parameters.KcpPort;
kcpBound.settings.clients[0].id = parameters.UUID;
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
@ -178,7 +186,7 @@ namespace ProxySU_Core.Models.Developers
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
{
var ssBound = GetBound("Shadowsocks-AEAD.json");
ssBound.port = ShadowSocksPort;
ssBound.port = parameters.ShadowSocksPort;
ssBound.settings.clients[0].password = parameters.ShadowsocksPassword;
ssBound.settings.clients[0].method = parameters.ShadowsocksMethod;
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));

View File

@ -8,6 +8,10 @@ namespace ProxySU_Core.Models.Developers
{
int Port { get; set; }
int KcpPort { get; set; }
int ShadowSocksPort { get; set; }
string Domain { get; set; }
List<XrayType> Types { get; set; }

View File

@ -308,12 +308,12 @@ namespace ProxySU_Core.Models.Developers
if (Parameters.Types.Contains(XrayType.ShadowsocksAEAD))
{
portList.Add(ConfigBuilder.ShadowSocksPort);
portList.Add(Parameters.ShadowSocksPort);
}
if (Parameters.Types.Contains(XrayType.VMESS_KCP))
{
portList.Add(ConfigBuilder.VMESS_mKCP_Port);
portList.Add(Parameters.KcpPort);
}
OpenPort(portList.ToArray());
@ -468,7 +468,7 @@ namespace ProxySU_Core.Models.Developers
return true;
}
public void ConfigurePort(bool force = true)
public void ConfigurePort()
{
if (Parameters.Port == 80 || Parameters.Port == 443)
{
@ -480,6 +480,8 @@ namespace ProxySU_Core.Models.Developers
SetPortFree(80);
SetPortFree(443);
SetPortFree(Parameters.Port);
SetPortFree(Parameters.KcpPort);
SetPortFree(Parameters.ShadowSocksPort);
}
}

View File

@ -87,7 +87,6 @@ namespace ProxySU_Core.Models.Developers
WriteOutput("启动BBR");
EnableBBR();
WriteOutput("BBR启动成功");
UploadCaddyFile();
WriteOutput("************");
@ -112,7 +111,7 @@ namespace ProxySU_Core.Models.Developers
WriteOutput("卸载证书");
UninstallAcme();
WriteOutput("关闭端口");
ClosePort(ConfigBuilder.ShadowSocksPort, ConfigBuilder.VLESS_mKCP_Port, ConfigBuilder.VMESS_mKCP_Port);
ClosePort(Parameters.ShadowSocksPort, Parameters.KcpPort);
WriteOutput("************ 卸载完成 ************");
}
@ -141,6 +140,8 @@ namespace ProxySU_Core.Models.Developers
var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
RunCmd("rm -rf /usr/local/etc/xray/config.json");
UploadFile(stream, "/usr/local/etc/xray/config.json");
ConfigurePort();
UploadCaddyFile(string.IsNullOrEmpty(Parameters.MaskDomain));
RunCmd("systemctl restart xray");
WriteOutput("************ 更新Xray配置成功更新配置不包含域名如果域名更换请重新安装。 ************");
}
@ -268,6 +269,7 @@ namespace ProxySU_Core.Models.Developers
{
RemoveNat64();
}
WriteOutput("BBR启动成功");
}
if (!canInstallBBR)
@ -382,14 +384,14 @@ namespace ProxySU_Core.Models.Developers
result = RunCmd(cmd);
}
if (result.Contains("Cert success"))
if (result.Contains("success"))
{
WriteOutput("申请证书成功");
}
else
{
WriteOutput("申请证书失败,请联系开发者!");
throw new Exception("申请证书失败,请联系开发者!");
WriteOutput("申请证书失败,如果申次数过多请更换二级域名,或联系开发者!");
throw new Exception("申请证书失败,如果申次数过多请更换二级域名,或联系开发者!");
}
// 安装证书到xray

View File

@ -38,7 +38,7 @@ namespace ProxySU_Core.Models
var _method = settings.ShadowsocksMethod;
var _password = settings.ShadowsocksPassword;
var _server = settings.Domain;
var _port = ConfigBuilder.ShadowSocksPort;
var _port = settings.ShadowSocksPort;
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
return "ss://" + base64URL;
@ -77,7 +77,7 @@ namespace ProxySU_Core.Models
break;
case XrayType.VMESS_KCP:
vmess.ps = "vmess-mKCP";
vmess.port = ConfigBuilder.VMESS_mKCP_Port.ToString();
vmess.port = settings.KcpPort.ToString();
vmess.net = "kcp";
vmess.type = settings.VMESS_KCP_Type;
vmess.path = settings.VMESS_KCP_Seed;

View File

@ -17,6 +17,9 @@ namespace ProxySU_Core.Models
{
var guid = Guid.NewGuid().ToString();
Port = 443;
KcpPort = 10443;
ShadowSocksPort = 11443;
UUID = guid;
Types = new List<XrayType>();
@ -41,6 +44,14 @@ namespace ProxySU_Core.Models
/// </summary>
public int Port { get; set; }
/// <summary>
/// kcp端口
/// </summary>
public int KcpPort { get; set; }
// ss端口
public int ShadowSocksPort { get; set; }
/// <summary>
/// UUID
/// </summary>

View File

@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.1.0")]
[assembly: AssemblyFileVersion("3.1.1.0")]

View File

@ -129,6 +129,7 @@
<Compile Include="Tools\DateTimeUtils.cs" />
<Compile Include="Tools\Extensions.cs" />
<Compile Include="ViewModels\BaseCommand.cs" />
<Compile Include="ViewModels\BaseModel.cs" />
<Compile Include="ViewModels\BaseViewModel.cs" />
<Compile Include="Models\Developers\ConfigBuilder.cs" />
<Compile Include="Models\Developers\IParameters.cs" />

View File

@ -1,4 +1,4 @@
##domain##:80 {
##domain##:##port## {
root * /usr/share/caddy
file_server
##reverse_proxy##

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySU_Core.ViewModels
{
public class BaseViewModel2 : INotifyPropertyChanged
{
protected bool SetProperty<T>(ref T backingStore, T value,
string propertyName = "",
Action onChanged = null)
{
if (EqualityComparer<T>.Default.Equals(backingStore, value))
return false;
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName = "")
{
var changed = PropertyChanged;
if (changed == null)
return;
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}

View File

@ -23,6 +23,37 @@ namespace ProxySU_Core.ViewModels
Notify("VMESS_KCP_Type");
}
public int Port
{
get => settings.Port;
set
{
settings.Port = value;
Notify("Port");
}
}
public int KcpPort
{
get => settings.KcpPort;
set
{
settings.KcpPort = value;
Notify("KcpPort");
}
}
public int ShadowSocksPort
{
get => settings.ShadowSocksPort;
set
{
settings.KcpPort = value;
Notify("ShadowSocksPort");
}
}
public string UUID
{
get => settings.UUID;
@ -168,7 +199,7 @@ namespace ProxySU_Core.ViewModels
{
get => ShareLink.Build(XrayType.VMESS_WS, settings);
}
// vmess kcp
public string VMESS_KCP_Seed
{

View File

@ -322,7 +322,7 @@
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="端口(port)" Width="120" />
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.VMESS_mKCP_Port},Mode=OneTime}" IsReadOnly="True" Width="200" />
<TextBox Text="{Binding Path=Settings.KcpPort,Mode=OneTime}" IsReadOnly="True" Width="200" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
@ -404,7 +404,7 @@
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="服务器端口" Width="120" />
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.ShadowSocksPort},Mode=OneTime}" IsReadOnly="True" Width="200" />
<TextBox Text="{Binding Path=ShadowSocksPort,Mode=OneTime}" IsReadOnly="True" Width="200" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">

View File

@ -125,9 +125,27 @@
<TabItem
Width="160"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="其他功能">
Header="说明文档">
<StackPanel>
<TextBlock Text="还不知道要点啥...看大家建议?" />
<StackPanel Margin="0,10,0,0">
<TextBlock Text="新书指引:" FontWeight="Black" />
<TextBlock Text="1. 【添加主机】,填写主机信息及节点配置信息,保存。" />
<TextBlock Text="2. 点【控制台】,自动连接主机,连接成功后,点【一键安装】,待输出 “请尽情享用吧” 代表安装完成。" />
<TextBlock Text="3. 在【查看配置】中可以查看节点配置信息,选中【导出配置】可以复制所有节点的分享拦截。" />
</StackPanel>
<StackPanel Margin="0,10,0,0">
<TextBlock Text="自定义功能" FontWeight="Black" />
<TextBlock Text="【更新配置】用户想修改节点的信息比如增加一个websocket或修改用户id在【编辑】中修改保存后不需要重新安装了这个功能就可以更新配置。" />
<TextBlock Text="【更新内核】更新官方xray-core的最新版本。" />
<TextBlock Text="【卸载代理】:卸载 域名证书、caddy服务、xray内核一些安装过程中的基础功能不影响不卸载会影响到您的系统请自行处理。" />
<TextBlock Text="【续签证书】:默认是会自动续签的,但由于各种平台的基础环境不一样,可能有些会续签失败,这个功能可手动续签证书。" />
<TextBlock Text="【上传证书】:上传自有证书,将您的证书 crt 和 key 文件打包zip上传即可。" />
<TextBlock Text="【上传网站】上传伪装静态网站静态网站必须根目录有一个index.html文件请自行检查。" />
</StackPanel>
<StackPanel Margin="0,10,0,0">
<TextBlock Text="关于v3版本" FontWeight="Black" />
<TextBlock Text="初步以xray为基础方便自动安装、修改、卸载看建议再考虑其他方式如有需要请先用v2的版本。" />
</StackPanel>
</StackPanel>
</TabItem>
</TabControl>

View File

@ -222,6 +222,8 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<StackPanel>
<Label Content="默认端口请避开1000-1999回落端口" />
<CheckBox Content="VLESS OVER TCP with XTLS"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Settings.Checked_VLESS_TCP_XTLS}"
@ -273,7 +275,17 @@
</StackPanel>
<StackPanel Margin="60,0,0,0">
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
<Label Content="xray" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.Port}" Width="50" VerticalAlignment="Center" />
<Label Content="ss" Margin="10,0,0,0" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.ShadowSocksPort}" Width="50" VerticalAlignment="Center" />
<Label Content="mkcp" Margin="10,0,0,0" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.KcpPort}" Width="50" VerticalAlignment="Center" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<Label Content="UUID" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.UUID}" Width="200" />
<Button Style="{StaticResource MahApps.Styles.Button.Flat}"

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:ProxySU_Core"
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="主机控制台" Height="500" Width="800">
Title="主机控制台" Height="600" Width="800">
<StackPanel>
<TextBox IsReadOnly="True"
Block.LineHeight="18"
@ -27,12 +27,19 @@
VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Button Content="安装Xray"
<Button Content="一键安装"
Click="Install"
Height="26"
IsEnabled="{Binding HasConnected}"
Width="120"/>
<Button Content="更新配置"
Margin="10,0,0,0"
Click="UpdateXraySettings"
Height="26"
IsEnabled="{Binding HasConnected}"
Width="120"/>
<Button Content="更新Xray内核"
Margin="10,0,0,0"
Click="UpdateXrayCore"
@ -40,13 +47,6 @@
IsEnabled="{Binding HasConnected}"
Width="120"/>
<Button Content="更新Xray配置"
Margin="10,0,0,0"
Click="UpdateXraySettings"
Height="26"
IsEnabled="{Binding HasConnected}"
Width="120"/>
<Button Content="卸载代理"
Margin="10,0,0,0"
Click="UninstallXray"
@ -61,7 +61,7 @@
VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Button Content="申请证书"
<Button Content="续签证书"
Margin="0,0,0,0"
Height="26"
Width="120"
@ -75,7 +75,7 @@
IsEnabled="{Binding HasConnected}"
Click="UploadCert"/>
<Button Content="上传伪装网站"
<Button Content="上传网站"
Margin="10,0,0,0"
Height="26"
Width="120"
@ -92,7 +92,15 @@
</StackPanel>
<StackPanel Margin="10,0,0,0">
<Label Content="静态网页模版(感谢网友推荐),将网站压缩包上传到服务区即可。" />
<Label Content="说明:"/>
<StackPanel Margin="10,0,0,0">
<Label Content="一键安装: 最后输出 “请尽情享用” 表示完成,到[查看配置]或[导出配置]查看节点" />
<Label Content="更新配置: 修改节点配置信息后,不需要重新安装,这个功能就可以更新配置了" />
<Label Content="续签证书: 证书默认是自动续签,但不保证都能续签成功,如果失败请用[续签证书]手动续签" />
<Label Content="上传网站: 伪装网站正确的静态网页要有index.html文件(请检查),然后将网站压缩包上传。" />
</StackPanel>
<Label Content="如下是网友提供的静态网页连接请自行检查是否有index.html文件" />
<TextBlock>
<Hyperlink NavigateUri="https://www.themezy.com" Click="OpenLink">Themezy</Hyperlink>
</TextBlock>