using Newtonsoft.Json; using ProxySuper.Core.Services; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProxySuper.Core.Models.Projects { public class TrojanGoSettings : IProjectSettings { public TrojanGoSettings() { Port = 443; WebSocketPath = "/ws"; Password = Guid.NewGuid().ToString(); } public List FreePorts { get { return new List(); } } public ProjectType Type { get; set; } = ProjectType.TrojanGo; /// /// 域名 /// public string Domain { get; set; } /// /// 端口 /// public int Port { get; set; } /// /// 密码 /// public string Password { get; set; } /// /// 伪装域名 /// public string MaskDomain { get; set; } /// /// 是否开启WebSocket /// [JsonIgnore] public bool EnableWebSocket { get { return !string.IsNullOrEmpty(WebSocketPath); } } /// /// websocket路径 /// public string WebSocketPath { get; set; } [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"; } } } }