1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-26 15:16:08 +03:00
ProxySU/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs

89 lines
2.0 KiB
C#
Raw Normal View History

2021-05-23 12:40:06 +03:00
using Newtonsoft.Json;
2021-05-24 13:57:17 +03:00
using ProxySuper.Core.Services;
2021-05-23 12:40:06 +03:00
using System;
2021-05-13 04:58:45 +03:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2021-05-14 14:07:19 +03:00
namespace ProxySuper.Core.Models.Projects
2021-05-13 04:58:45 +03:00
{
public class TrojanGoSettings : IProjectSettings
{
2021-05-23 09:24:13 +03:00
public TrojanGoSettings()
{
Port = 443;
2021-05-24 13:57:17 +03:00
WebSocketPath = "/ws";
2021-06-17 13:54:07 +03:00
Password = Guid.NewGuid().ToString();
2021-05-23 09:24:13 +03:00
}
2021-05-20 13:32:17 +03:00
public List<int> FreePorts
2021-05-13 04:58:45 +03:00
{
get
{
return new List<int>();
}
}
2021-05-20 13:32:17 +03:00
public ProjectType Type { get; set; } = ProjectType.TrojanGo;
2021-05-14 14:07:19 +03:00
2021-05-13 04:58:45 +03:00
/// <summary>
/// 域名
/// </summary>
2021-05-20 13:32:17 +03:00
public string Domain { get; set; }
2021-05-13 04:58:45 +03:00
/// <summary>
/// 端口
/// </summary>
2021-05-20 13:32:17 +03:00
public int Port { get; set; }
2021-05-13 04:58:45 +03:00
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 伪装域名
/// </summary>
public string MaskDomain { get; set; }
2021-05-20 13:32:17 +03:00
/// <summary>
/// 是否开启WebSocket
/// </summary>
2021-05-23 12:40:06 +03:00
[JsonIgnore]
2021-05-20 13:32:17 +03:00
public bool EnableWebSocket
{
get
{
2021-05-24 13:57:17 +03:00
return !string.IsNullOrEmpty(WebSocketPath);
2021-05-20 13:32:17 +03:00
}
}
/// <summary>
/// websocket路径
/// </summary>
public string WebSocketPath { get; set; }
2021-06-17 13:54:07 +03:00
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
var prefix = Password.Length > 7 ? Password.Substring(0, 7) : Password;
return $"{prefix}@gmail.com";
}
}
2021-05-13 04:58:45 +03:00
}
}