2021-03-17 06:58:56 +03:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using ProxySU_Core.Common;
|
|
|
|
|
using ProxySU_Core.Models.Developers;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
using System;
|
2021-02-25 04:59:06 +03:00
|
|
|
|
using System.Collections.Generic;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
using System.Linq;
|
2021-02-25 04:59:06 +03:00
|
|
|
|
using System.Text;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
using System.Threading.Tasks;
|
2021-03-17 06:58:56 +03:00
|
|
|
|
using System.Web;
|
2021-02-25 04:59:06 +03:00
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
namespace ProxySU_Core.Models
|
2021-02-25 04:59:06 +03:00
|
|
|
|
{
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public class XraySettings : IParameters
|
2021-02-25 04:59:06 +03:00
|
|
|
|
{
|
2021-03-04 11:25:36 +03:00
|
|
|
|
|
|
|
|
|
public XraySettings()
|
|
|
|
|
{
|
2021-03-12 10:59:20 +03:00
|
|
|
|
var guid = Guid.NewGuid().ToString();
|
2021-03-04 11:25:36 +03:00
|
|
|
|
Port = 443;
|
2021-04-17 15:58:15 +03:00
|
|
|
|
VLESS_KCP_Port = 2001;
|
|
|
|
|
VLESS_gRPC_Port = 2002;
|
|
|
|
|
VMESS_KCP_Port = 3001;
|
|
|
|
|
ShadowSocksPort = 4001;
|
2021-04-05 05:22:43 +03:00
|
|
|
|
|
2021-03-12 10:59:20 +03:00
|
|
|
|
UUID = guid;
|
2021-03-17 06:58:56 +03:00
|
|
|
|
Types = new List<XrayType>();
|
2021-03-26 13:13:32 +03:00
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
VLESS_WS_Path = "/vlessws";
|
2021-03-18 10:17:07 +03:00
|
|
|
|
VLESS_H2_Path = "/vlessh2";
|
2021-04-18 13:11:35 +03:00
|
|
|
|
VLESS_KCP_Type = "none";
|
|
|
|
|
VLESS_KCP_Seed = guid;
|
2021-04-17 15:58:15 +03:00
|
|
|
|
VLESS_gRPC_ServiceName = "xray_gRPC";
|
2021-03-26 13:13:32 +03:00
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
VMESS_WS_Path = "/vmessws";
|
|
|
|
|
VMESS_TCP_Path = "/vmesstcp";
|
2021-03-18 10:17:07 +03:00
|
|
|
|
VMESS_H2_Path = "/vmessh2";
|
2021-03-26 13:13:32 +03:00
|
|
|
|
VMESS_KCP_Seed = guid;
|
|
|
|
|
VMESS_KCP_Type = "none";
|
|
|
|
|
|
2021-03-12 10:59:20 +03:00
|
|
|
|
TrojanPassword = guid;
|
2021-03-18 10:17:07 +03:00
|
|
|
|
Trojan_WS_Path = "/trojanws";
|
2021-03-26 13:13:32 +03:00
|
|
|
|
|
|
|
|
|
ShadowsocksPassword = guid;
|
|
|
|
|
ShadowsocksMethod = "aes-128-gcm";
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 访问端口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
|
2021-04-05 05:22:43 +03:00
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// UUID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string UUID { get; set; }
|
|
|
|
|
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#region vless
|
2021-04-17 15:58:15 +03:00
|
|
|
|
|
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// vless ws路径
|
|
|
|
|
/// </summary>
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string VLESS_WS_Path { get; set; }
|
2021-02-25 04:59:06 +03:00
|
|
|
|
|
2021-03-17 14:36:35 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// vless http2 path
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VLESS_H2_Path { get; set; }
|
2021-04-17 06:50:31 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// vless kcp seed
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VLESS_KCP_Seed { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// vless kcp type
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VLESS_KCP_Type { get; set; }
|
2021-04-17 15:58:15 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// vless kcp端口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int VLESS_KCP_Port { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// grpc service name
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VLESS_gRPC_ServiceName { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// grpc port
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int VLESS_gRPC_Port { get; set; }
|
|
|
|
|
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#endregion
|
2021-03-17 14:36:35 +03:00
|
|
|
|
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#region vmess
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// vmess ws路径
|
|
|
|
|
/// </summary>
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string VMESS_WS_Path { get; set; }
|
2021-02-25 04:59:06 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// vmess tcp路径
|
|
|
|
|
/// </summary>
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string VMESS_TCP_Path { get; set; }
|
2021-02-25 04:59:06 +03:00
|
|
|
|
|
2021-03-17 14:36:35 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// vmess http2 path
|
|
|
|
|
/// </summary>
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public string VMESS_H2_Path { get; set; }
|
2021-03-17 14:36:35 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-03-26 13:13:32 +03:00
|
|
|
|
/// vmess kcp seed
|
2021-03-17 14:36:35 +03:00
|
|
|
|
/// </summary>
|
2021-03-26 13:13:32 +03:00
|
|
|
|
public string VMESS_KCP_Seed { get; set; }
|
2021-03-17 14:36:35 +03:00
|
|
|
|
|
2021-03-26 13:13:32 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// vmess kcp type
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VMESS_KCP_Type { get; set; }
|
2021-04-17 15:58:15 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// vmess kcp端口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int VMESS_KCP_Port { get; set; }
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Trojan
|
2021-02-28 09:19:26 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// trojan密码
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// </summary>
|
2021-02-28 09:19:26 +03:00
|
|
|
|
public string TrojanPassword { get; set; }
|
2021-02-25 04:59:06 +03:00
|
|
|
|
|
2021-03-17 14:36:35 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// trojan ws path
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Trojan_WS_Path { get; set; }
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ShadowsocksAEAD
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ss password
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ShadowsocksPassword { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ss method
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ShadowsocksMethod { get; set; }
|
2021-04-17 15:58:15 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ss端口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int ShadowSocksPort { get; set; }
|
2021-03-26 13:13:32 +03:00
|
|
|
|
#endregion
|
|
|
|
|
|
2021-03-17 14:36:35 +03:00
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 域名
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Domain { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 伪装域名
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string MaskDomain { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 安装类型
|
|
|
|
|
/// </summary>
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public List<XrayType> Types { get; set; }
|
2021-02-28 09:19:26 +03:00
|
|
|
|
|
2021-05-08 06:45:46 +03:00
|
|
|
|
public List<int> FreePorts
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return new List<int>
|
|
|
|
|
{
|
|
|
|
|
VLESS_gRPC_Port,
|
|
|
|
|
VLESS_KCP_Port,
|
|
|
|
|
VMESS_KCP_Port,
|
|
|
|
|
ShadowSocksPort,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-28 09:19:26 +03:00
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string GetPath(XrayType type)
|
2021-02-28 09:19:26 +03:00
|
|
|
|
{
|
2021-03-04 11:25:36 +03:00
|
|
|
|
switch (type)
|
2021-02-28 09:19:26 +03:00
|
|
|
|
{
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.VLESS_WS:
|
2021-03-04 11:25:36 +03:00
|
|
|
|
return VLESS_WS_Path;
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.VLESS_H2:
|
2021-03-17 14:36:35 +03:00
|
|
|
|
return VLESS_H2_Path;
|
|
|
|
|
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.VMESS_TCP:
|
2021-03-04 11:25:36 +03:00
|
|
|
|
return VMESS_TCP_Path;
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.VMESS_WS:
|
2021-03-04 11:25:36 +03:00
|
|
|
|
return VMESS_WS_Path;
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.Trojan_WS:
|
2021-03-17 14:36:35 +03:00
|
|
|
|
return Trojan_WS_Path;
|
|
|
|
|
|
|
|
|
|
// no path
|
2021-03-26 13:13:32 +03:00
|
|
|
|
case XrayType.VLESS_TCP_XTLS:
|
|
|
|
|
case XrayType.VLESS_TCP:
|
|
|
|
|
case XrayType.VLESS_KCP:
|
|
|
|
|
case XrayType.VMESS_KCP:
|
|
|
|
|
case XrayType.Trojan_TCP:
|
2021-03-05 05:34:39 +03:00
|
|
|
|
return string.Empty;
|
2021-02-28 09:19:26 +03:00
|
|
|
|
default:
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-17 06:58:56 +03:00
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-17 06:58:56 +03:00
|
|
|
|
|
2021-02-25 04:59:06 +03:00
|
|
|
|
}
|