using SQLite; namespace ServiceLib.Models { [Serializable] public class ProfileItem { public ProfileItem() { indexId = string.Empty; configType = EConfigType.VMess; configVersion = 2; address = string.Empty; port = 0; id = string.Empty; alterId = 0; security = string.Empty; network = string.Empty; remarks = string.Empty; headerType = string.Empty; requestHost = string.Empty; path = string.Empty; streamSecurity = string.Empty; allowInsecure = string.Empty; subid = string.Empty; flow = string.Empty; } #region function public string GetSummary() { string summary = string.Format("[{0}] ", (configType).ToString()); string[] arrAddr = address.Split('.'); string addr; if (arrAddr.Length > 2) { addr = $"{arrAddr[0]}***{arrAddr[arrAddr.Length - 1]}"; } else if (arrAddr.Length > 1) { addr = $"***{arrAddr[arrAddr.Length - 1]}"; } else { addr = address; } switch (configType) { case EConfigType.Custom: summary += string.Format("[{1}]{0}", remarks, coreType.ToString()); break; default: summary += string.Format("{0}({1}:{2})", remarks, addr, port); break; } return summary; } public List GetAlpn() { if (Utils.IsNullOrEmpty(alpn)) { return null; } else { return Utils.String2List(alpn); } } public string GetNetwork() { if (Utils.IsNullOrEmpty(network) || !Global.Networks.Contains(network)) { return Global.DefaultNetwork; } return network.TrimEx(); } #endregion function [PrimaryKey] public string indexId { get; set; } /// /// config type(1=normal,2=custom) /// public EConfigType configType { get; set; } /// /// 版本(现在=2) /// public int configVersion { get; set; } /// /// 远程服务器地址 /// public string address { get; set; } /// /// 远程服务器端口 /// public int port { get; set; } /// /// 远程服务器ID /// public string id { get; set; } /// /// 远程服务器额外ID /// public int alterId { get; set; } /// /// 本地安全策略 /// public string security { get; set; } /// /// tcp,kcp,ws,h2,quic /// public string network { get; set; } /// /// /// public string remarks { get; set; } /// /// 伪装类型 /// public string headerType { get; set; } /// /// 伪装的域名 /// public string requestHost { get; set; } /// /// ws h2 path /// public string path { get; set; } /// /// 传输层安全 /// public string streamSecurity { get; set; } /// /// 是否允许不安全连接(用于客户端) /// public string allowInsecure { get; set; } /// /// SubItem id /// public string subid { get; set; } public bool isSub { get; set; } = true; /// /// VLESS flow /// public string flow { get; set; } /// /// tls sni /// public string sni { get; set; } /// /// tls alpn /// public string alpn { get; set; } = string.Empty; public ECoreType? coreType { get; set; } public int? preSocksPort { get; set; } public string fingerprint { get; set; } public bool displayLog { get; set; } = true; public string publicKey { get; set; } public string shortId { get; set; } public string spiderX { get; set; } } }