diff --git a/v2rayN/ServiceLib/Common/AesUtils.cs b/v2rayN/ServiceLib/Common/AesUtils.cs index c32c3bff..05f1cb38 100644 --- a/v2rayN/ServiceLib/Common/AesUtils.cs +++ b/v2rayN/ServiceLib/Common/AesUtils.cs @@ -8,7 +8,7 @@ public class AesUtils private const int KeySize = 256; // AES-256 private const int IvSize = 16; // AES block size private const int Iterations = 10000; - private static readonly byte[] Salt = Encoding.ASCII.GetBytes("saltysalt".PadRight(16, ' ')); // google浏览器默认盐值 + private static readonly byte[] Salt = Encoding.ASCII.GetBytes("saltysalt".PadRight(16, ' ')); private static readonly string DefaultPassword = Utils.GetMd5(Utils.GetHomePath() + "AesUtils"); /// diff --git a/v2rayN/ServiceLib/Common/JsonUtils.cs b/v2rayN/ServiceLib/Common/JsonUtils.cs index ea651022..773ba79c 100644 --- a/v2rayN/ServiceLib/Common/JsonUtils.cs +++ b/v2rayN/ServiceLib/Common/JsonUtils.cs @@ -88,7 +88,7 @@ public class JsonUtils { WriteIndented = indented, DefaultIgnoreCondition = nullValue ? JsonIgnoreCondition.Never : JsonIgnoreCondition.WhenWritingNull, - Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping // 避免转义加号 + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; result = JsonSerializer.Serialize(obj, options); } diff --git a/v2rayN/ServiceLib/Common/YamlUtils.cs b/v2rayN/ServiceLib/Common/YamlUtils.cs index e9be015f..a95e1b0a 100644 --- a/v2rayN/ServiceLib/Common/YamlUtils.cs +++ b/v2rayN/ServiceLib/Common/YamlUtils.cs @@ -11,7 +11,7 @@ public class YamlUtils #region YAML /// - /// 反序列化成对象 + /// Deserialize /// /// /// @@ -34,7 +34,7 @@ public class YamlUtils } /// - /// 序列化 + /// Serialize /// /// /// diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index c0311199..a23b1c67 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -3,9 +3,6 @@ using System.Text.RegularExpressions; namespace ServiceLib.Handler; -/// -/// 本软件配置文件处理类 -/// public class ConfigHandler { private static readonly string _configRes = Global.ConfigFileName; @@ -14,10 +11,12 @@ public class ConfigHandler #region ConfigHandler /// - /// 载入配置文件 + /// Load the application configuration file + /// If the file exists, deserialize it from JSON + /// If not found, create a new Config object with default settings + /// Initialize default values for missing configuration sections /// - /// - /// + /// Config object containing application settings or null if there's an error public static Config? LoadConfig() { Config? config = null; @@ -169,10 +168,11 @@ public class ConfigHandler } /// - /// 保参数 + /// Save the configuration to a file + /// First writes to a temporary file, then replaces the original file /// - /// - /// + /// Configuration object to be saved + /// 0 if successful, -1 if failed public static async Task SaveConfig(Config config) { try @@ -204,6 +204,13 @@ public class ConfigHandler #region Server + /// + /// Add a server profile to the configuration + /// Dispatches the request to the appropriate method based on the config type + /// + /// Current configuration + /// Server profile to add + /// Result of the operation (0 if successful, -1 if failed) public static async Task AddServer(Config config, ProfileItem profileItem) { var item = await AppHandler.Instance.GetProfileItem(profileItem.IndexId); @@ -258,11 +265,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a VMess server + /// Validates and processes VMess-specific settings /// - /// - /// - /// + /// Current configuration + /// VMess profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddVMessServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.VMess; @@ -291,11 +300,11 @@ public class ConfigHandler } /// - /// 移除服务器 + /// Remove multiple servers from the configuration /// - /// - /// - /// + /// Current configuration + /// List of server profiles to remove + /// 0 if successful public static async Task RemoveServers(Config config, List indexes) { var subid = "TempRemoveSubId"; @@ -311,11 +320,12 @@ public class ConfigHandler } /// - /// 克隆服务器 + /// Clone server profiles + /// Creates copies of the specified server profiles with "-clone" appended to the remarks /// - /// - /// - /// + /// Current configuration + /// List of server profiles to clone + /// 0 if successful public static async Task CopyServer(Config config, List indexes) { foreach (var it in indexes) @@ -347,11 +357,12 @@ public class ConfigHandler } /// - /// 设置活动服务器 + /// Set the default server by its index ID + /// Updates the configuration to use the specified server as default /// - /// - /// - /// + /// Current configuration + /// Index ID of the server to set as default + /// 0 if successful, -1 if failed public static async Task SetDefaultServerIndex(Config config, string? indexId) { if (indexId.IsNullOrEmpty()) @@ -366,6 +377,13 @@ public class ConfigHandler return 0; } + /// + /// Set a default server from the provided list of profiles + /// Ensures there's always a valid default server selected + /// + /// Current configuration + /// List of profile models to choose from + /// Result of SetDefaultServerIndex operation public static async Task SetDefaultServer(Config config, List lstProfile) { if (lstProfile.Exists(t => t.IndexId == config.IndexId)) @@ -386,6 +404,12 @@ public class ConfigHandler return await SetDefaultServerIndex(config, item?.IndexId); } + /// + /// Get the current default server profile + /// If the current default is invalid, selects a new default + /// + /// Current configuration + /// The default profile item or null if none exists public static async Task GetDefaultServer(Config config) { var item = await AppHandler.Instance.GetProfileItem(config.IndexId); @@ -400,13 +424,15 @@ public class ConfigHandler } /// - /// 移动服务器 + /// Move a server in the list to a different position + /// Supports moving to top, up, down, bottom or specific position /// - /// - /// - /// - /// - /// + /// Current configuration + /// List of server profiles + /// Index of the server to move + /// Direction to move the server + /// Target position when using EMove.Position + /// 0 if successful, -1 if failed public static async Task MoveServer(Config config, List lstProfile, int index, EMove eMove, int pos = -1) { int count = lstProfile.Count; @@ -474,11 +500,13 @@ public class ConfigHandler } /// - /// 添加自定义服务器 + /// Add a custom server configuration from a file + /// Copies the configuration file to the app's config directory /// - /// - /// - /// + /// Current configuration + /// Profile item with the file path in Address + /// Whether to delete the source file after copying + /// 0 if successful, -1 if failed public static async Task AddCustomServer(Config config, ProfileItem profileItem, bool blDelete) { var fileName = profileItem.Address; @@ -517,11 +545,12 @@ public class ConfigHandler } /// - /// Add or edit server + /// Edit an existing custom server configuration + /// Updates the server's properties without changing the file /// - /// - /// - /// + /// Current configuration + /// Profile item with updated properties + /// 0 if successful, -1 if failed public static async Task EditCustomServer(Config config, ProfileItem profileItem) { var item = await AppHandler.Instance.GetProfileItem(profileItem.IndexId); @@ -551,11 +580,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a Shadowsocks server + /// Validates and processes Shadowsocks-specific settings /// - /// - /// - /// + /// Current configuration + /// Shadowsocks profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddShadowsocksServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.Shadowsocks; @@ -579,11 +610,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a SOCKS server + /// Processes SOCKS-specific settings /// - /// - /// - /// + /// Current configuration + /// SOCKS profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddSocksServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.SOCKS; @@ -596,11 +629,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit an HTTP server + /// Processes HTTP-specific settings /// - /// - /// - /// + /// Current configuration + /// HTTP profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddHttpServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.HTTP; @@ -613,11 +648,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a Trojan server + /// Validates and processes Trojan-specific settings /// - /// - /// - /// + /// Current configuration + /// Trojan profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddTrojanServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.Trojan; @@ -639,11 +676,14 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a Hysteria2 server + /// Validates and processes Hysteria2-specific settings + /// Sets the core type to sing_box as required by Hysteria2 /// - /// - /// - /// + /// Current configuration + /// Hysteria2 profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddHysteria2Server(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.Hysteria2; @@ -669,11 +709,14 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a TUIC server + /// Validates and processes TUIC-specific settings + /// Sets the core type to sing_box as required by TUIC /// - /// - /// - /// + /// Current configuration + /// TUIC profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddTuicServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.TUIC; @@ -708,11 +751,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a WireGuard server + /// Validates and processes WireGuard-specific settings /// - /// - /// - /// + /// Current configuration + /// WireGuard profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddWireguardServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.WireGuard; @@ -738,6 +783,15 @@ public class ConfigHandler return 0; } + /// + /// Sort the server list by the specified column + /// Updates the sort order in the profile extension data + /// + /// Current configuration + /// Subscription ID to filter servers + /// Column name to sort by + /// Sort in ascending order if true, descending if false + /// 0 if successful, -1 if failed public static async Task SortServers(Config config, string subId, string colName, bool asc) { var lstModel = await AppHandler.Instance.ProfileItems(subId, ""); @@ -831,11 +885,13 @@ public class ConfigHandler } /// - /// Add or edit server + /// Add or edit a VLESS server + /// Validates and processes VLESS-specific settings /// - /// - /// - /// + /// Current configuration + /// VLESS profile to add + /// Whether to save to file + /// 0 if successful, -1 if failed public static async Task AddVlessServer(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigType = EConfigType.VLESS; @@ -867,6 +923,13 @@ public class ConfigHandler return 0; } + /// + /// Remove duplicate servers from a subscription + /// Compares servers based on their properties rather than just names + /// + /// Current configuration + /// Subscription ID to deduplicate + /// Tuple with total count and remaining count after deduplication public static async Task> DedupServerList(Config config, string subId) { var lstProfile = await AppHandler.Instance.ProfileItems(subId); @@ -898,6 +961,14 @@ public class ConfigHandler return new Tuple(lstProfile.Count, lstKeep.Count); } + /// + /// Common server addition logic used by all server types + /// Sets common properties and handles sorting and persistence + /// + /// Current configuration + /// Profile item to add + /// Whether to save to database + /// 0 if successful public static async Task AddServerCommon(Config config, ProfileItem profileItem, bool toFile = true) { profileItem.ConfigVersion = 2; @@ -949,6 +1020,14 @@ public class ConfigHandler return 0; } + /// + /// Compare two profile items to determine if they represent the same server + /// Used for deduplication and server matching + /// + /// First profile item + /// Second profile item + /// Whether to compare remarks + /// True if the profiles match, false otherwise private static bool CompareProfileItem(ProfileItem? o, ProfileItem? n, bool remarks) { if (o == null || n == null) @@ -980,6 +1059,13 @@ public class ConfigHandler } } + /// + /// Remove a single server profile by its index ID + /// Deletes the configuration file if it's a custom config + /// + /// Current configuration + /// Index ID of the profile to remove + /// 0 if successful private static async Task RemoveProfileItem(Config config, string indexId) { try @@ -1004,6 +1090,15 @@ public class ConfigHandler return 0; } + /// + /// Create a custom server that combines multiple servers for load balancing + /// Generates a configuration file that references multiple servers + /// + /// Current configuration + /// Selected servers to combine + /// Core type to use (Xray or sing_box) + /// Load balancing algorithm + /// Result object with success state and data public static async Task AddCustomServer4Multiple(Config config, List selecteds, ECoreType coreType, EMultipleLoad multipleLoad) { var indexId = Utils.GetMd5(Global.CoreMultipleLoadConfigFileName); @@ -1047,6 +1142,14 @@ public class ConfigHandler return result; } + /// + /// Get a SOCKS server profile for pre-SOCKS functionality + /// Used when TUN mode is enabled or when a custom config has a pre-SOCKS port + /// + /// Current configuration + /// Server node that might need pre-SOCKS + /// Core type being used + /// A SOCKS profile item or null if not needed public static async Task GetPreSocksItem(Config config, ProfileItem node, ECoreType coreType) { ProfileItem? itemSocks = null; @@ -1076,6 +1179,13 @@ public class ConfigHandler return itemSocks; } + /// + /// Remove servers with invalid test results (timeout) + /// Useful for cleaning up subscription lists + /// + /// Current configuration + /// Subscription ID to filter servers + /// Number of removed servers or -1 if failed public static async Task RemoveInvalidServerResult(Config config, string subid) { var lstModel = await AppHandler.Instance.ProfileItems(subid, ""); @@ -1099,12 +1209,14 @@ public class ConfigHandler #region Batch add servers /// - /// 批量添加服务器 + /// Add multiple servers from string data (common protocols) + /// Parses the string data into server profiles /// - /// - /// - /// - /// 成功导入的数量 + /// Current configuration + /// String data containing server information + /// Subscription ID to associate with the servers + /// Whether this is from a subscription + /// Number of successfully imported servers or -1 if failed private static async Task AddBatchServersCommon(Config config, string strData, string subid, bool isSub) { if (strData.IsNullOrEmpty()) @@ -1184,6 +1296,15 @@ public class ConfigHandler return countServers; } + /// + /// Add servers from custom configuration formats (sing-box, v2ray, etc.) + /// Handles various configuration formats and imports them as custom configs + /// + /// Current configuration + /// String data containing server information + /// Subscription ID to associate with the servers + /// Whether this is from a subscription + /// Number of successfully imported servers or -1 if failed private static async Task AddBatchServers4Custom(Config config, string strData, string subid, bool isSub) { if (strData.IsNullOrEmpty()) @@ -1282,6 +1403,15 @@ public class ConfigHandler } } + /// + /// Add Shadowsocks servers from SIP008 format + /// SIP008 is a JSON-based format for Shadowsocks servers + /// + /// Current configuration + /// String data in SIP008 format + /// Subscription ID to associate with the servers + /// Whether this is from a subscription + /// Number of successfully imported servers or -1 if failed private static async Task AddBatchServers4SsSIP008(Config config, string strData, string subid, bool isSub) { if (strData.IsNullOrEmpty()) @@ -1314,6 +1444,15 @@ public class ConfigHandler return -1; } + /// + /// Main entry point for adding batch servers from various formats + /// Tries different parsing methods to import as many servers as possible + /// + /// Current configuration + /// String data containing server information + /// Subscription ID to associate with the servers + /// Whether this is from a subscription + /// Number of successfully imported servers or -1 if failed public static async Task AddBatchServers(Config config, string strData, string subid, bool isSub) { if (strData.IsNullOrEmpty()) @@ -1386,11 +1525,12 @@ public class ConfigHandler #region Sub & Group /// - /// add sub + /// Add a subscription item from URL + /// Creates a new subscription with default settings /// - /// - /// - /// + /// Current configuration + /// Subscription URL + /// 0 if successful, -1 if failed public static async Task AddSubItem(Config config, string url) { //already exists @@ -1422,6 +1562,12 @@ public class ConfigHandler return await AddSubItem(config, subItem); } + /// + /// Add or update a subscription item + /// + /// Current configuration + /// Subscription item to add or update + /// 0 if successful, -1 if failed public static async Task AddSubItem(Config config, SubItem subItem) { var item = await AppHandler.Instance.GetSubItem(subItem.Id); @@ -1473,11 +1619,12 @@ public class ConfigHandler } /// - /// 移除服务器 + /// Remove servers associated with a subscription ID /// - /// - /// - /// + /// Current configuration + /// Subscription ID + /// Whether to only remove servers marked as subscription items + /// 0 if successful, -1 if failed public static async Task RemoveServersViaSubid(Config config, string subid, bool isSub) { if (subid.IsNullOrEmpty()) @@ -1501,6 +1648,12 @@ public class ConfigHandler return 0; } + /// + /// Delete a subscription item and all its associated servers + /// + /// Current configuration + /// Subscription ID to delete + /// 0 if successful public static async Task DeleteSubItem(Config config, string id) { var item = await AppHandler.Instance.GetSubItem(id); @@ -1514,6 +1667,13 @@ public class ConfigHandler return 0; } + /// + /// Move servers to a different group (subscription) + /// + /// Current configuration + /// List of profiles to move + /// Target subscription ID + /// 0 if successful public static async Task MoveToGroup(Config config, List lstProfile, string subid) { foreach (var item in lstProfile) @@ -1529,6 +1689,12 @@ public class ConfigHandler #region Routing + /// + /// Save a routing item to the database + /// + /// Current configuration + /// Routing item to save + /// 0 if successful, -1 if failed public static async Task SaveRoutingItem(Config config, RoutingItem item) { if (item.Id.IsNullOrEmpty()) @@ -1547,11 +1713,11 @@ public class ConfigHandler } /// - /// AddBatchRoutingRules + /// Add multiple routing rules to a routing item /// - /// - /// - /// + /// Routing item to add rules to + /// JSON string containing rules data + /// 0 if successful, -1 if failed public static async Task AddBatchRoutingRules(RoutingItem routingItem, string strData) { if (strData.IsNullOrEmpty()) @@ -1588,12 +1754,14 @@ public class ConfigHandler } /// - /// MoveRoutingRule + /// Move a routing rule within a rules list + /// Supports moving to top, up, down, bottom or specific position /// - /// - /// - /// - /// + /// List of routing rules + /// Index of the rule to move + /// Direction to move the rule + /// Target position when using EMove.Position + /// 0 if successful, -1 if failed public static async Task MoveRoutingRule(List rules, int index, EMove eMove, int pos = -1) { int count = rules.Count; @@ -1664,6 +1832,12 @@ public class ConfigHandler return await Task.FromResult(0); } + /// + /// Set the default routing configuration + /// + /// Current configuration + /// Routing item to set as default + /// 0 if successful public static async Task SetDefaultRouting(Config config, RoutingItem routingItem) { if (await SQLiteHelper.Instance.TableAsync().Where(t => t.Id == routingItem.Id).CountAsync() > 0) @@ -1676,6 +1850,12 @@ public class ConfigHandler return 0; } + /// + /// Get the current default routing configuration + /// If no default is set, selects the first available routing item + /// + /// Current configuration + /// The default routing item public static async Task GetDefaultRouting(Config config) { var item = await AppHandler.Instance.GetRoutingItem(config.RoutingBasicItem.RoutingIndexId); @@ -1689,6 +1869,12 @@ public class ConfigHandler return item; } + /// + /// Initialize routing rules from built-in or external templates + /// + /// Current configuration + /// Whether to import advanced rules + /// 0 if successful public static async Task InitRouting(Config config, bool blImportAdvancedRules = false) { if (config.ConstItem.RouteRulesTemplateSourceUrl.IsNullOrEmpty()) @@ -1703,6 +1889,13 @@ public class ConfigHandler return 0; } + /// + /// Initialize routing rules from external templates + /// Downloads and processes routing templates from a URL + /// + /// Current configuration + /// Whether to import advanced rules + /// 0 if successful public static async Task InitExternalRouting(Config config, bool blImportAdvancedRules = false) { var downloadHandle = new DownloadService(); @@ -1751,6 +1944,13 @@ public class ConfigHandler return 0; } + /// + /// Initialize built-in routing rules + /// Creates default routing configurations (whitelist, blacklist, global) + /// + /// Current configuration + /// Whether to import advanced rules + /// 0 if successful public static async Task InitBuiltinRouting(Config config, bool blImportAdvancedRules = false) { var ver = "V3-"; @@ -1804,6 +2004,10 @@ public class ConfigHandler return 0; } + /// + /// Remove a routing item from the database + /// + /// Routing item to remove public static async Task RemoveRoutingItem(RoutingItem routingItem) { await SQLiteHelper.Instance.DeleteAsync(routingItem); @@ -1813,6 +2017,12 @@ public class ConfigHandler #region DNS + /// + /// Initialize built-in DNS configurations + /// Creates default DNS items for V2Ray and sing-box + /// + /// Current configuration + /// 0 if successful public static async Task InitBuiltinDNS(Config config) { var items = await AppHandler.Instance.DNSItems(); @@ -1836,6 +2046,12 @@ public class ConfigHandler return 0; } + /// + /// Save a DNS item to the database + /// + /// Current configuration + /// DNS item to save + /// 0 if successful, -1 if failed public static async Task SaveDNSItems(Config config, DNSItem item) { if (item == null) @@ -1858,6 +2074,13 @@ public class ConfigHandler } } + /// + /// Get an external DNS configuration from URL + /// Downloads and processes DNS templates + /// + /// Core type (Xray or sing-box) + /// URL of the DNS template + /// DNS item with configuration from the URL public static async Task GetExternalDNSItem(ECoreType type, string url) { var currentItem = await AppHandler.Instance.GetDNSItem(type); @@ -1889,6 +2112,13 @@ public class ConfigHandler #region Regional Presets + /// + /// Apply regional presets for geo-specific configurations + /// Sets up geo files, routing rules, and DNS for specific regions + /// + /// Current configuration + /// Type of preset (Default, Russia, Iran) + /// True if successful public static async Task ApplyRegionalPreset(Config config, EPresetType type) { switch (type) diff --git a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs index 31b2e02d..86b92fa0 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs @@ -8,10 +8,13 @@ public class BaseFmt { if (Utils.IsIpv6(address)) { - // 检查地址是否已经被方括号包围,如果没有,则添加方括号 + // Check if the address is already surrounded by square brackets, if not, add square brackets return address.StartsWith('[') && address.EndsWith(']') ? address : $"[{address}]"; } - return address; // 如果不是IPv6地址,直接返回原地址 + else + { + return address; + } } protected static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary dicQuery) diff --git a/v2rayN/ServiceLib/Models/Config.cs b/v2rayN/ServiceLib/Models/Config.cs index 7a1e423c..15996608 100644 --- a/v2rayN/ServiceLib/Models/Config.cs +++ b/v2rayN/ServiceLib/Models/Config.cs @@ -1,8 +1,5 @@ namespace ServiceLib.Models; -/// -/// 本软件配置文件实体类 -/// [Serializable] public class Config { diff --git a/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs b/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs index 07a31d3d..c08284b4 100644 --- a/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs +++ b/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs @@ -1,8 +1,5 @@ namespace ServiceLib.Models; -/// -/// Tcp伪装http的Request,只要Host -/// public class V2rayTcpRequest { /// diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs index d6256e6a..481ae92d 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs @@ -12,14 +12,7 @@ public class CoreConfigClashService { _config = config; } - - /// - /// 生成配置文件 - /// - /// - /// - /// - /// + public async Task GenerateClientCustomConfig(ProfileItem node, string? fileName) { var ret = new RetResult(); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 4106dc43..1bd23872 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -661,7 +661,7 @@ public class CoreConfigV2rayService { usersItem = vnextItem.users.First(); } - //远程服务器用户ID + usersItem.id = node.Id; usersItem.alterId = node.AlterId; usersItem.email = Global.UserEMail; @@ -1143,7 +1143,7 @@ public class CoreConfigV2rayService obj["servers"] = JsonUtils.SerializeToNode(servers); } - // 追加至 dns 设置 + // Append to dns settings if (item.UseSystemHosts) { var systemHosts = Utils.GetSystemHosts(); diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index 4d2f5bc8..86518fa0 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -19,7 +19,7 @@ public partial class App : Application } /// - /// 只打开一个进程 + /// Open only one process /// /// protected override void OnStartup(StartupEventArgs e) diff --git a/v2rayN/v2rayN/Common/WindowsUtils.cs b/v2rayN/v2rayN/Common/WindowsUtils.cs index ad798cfb..346c7763 100644 --- a/v2rayN/v2rayN/Common/WindowsUtils.cs +++ b/v2rayN/v2rayN/Common/WindowsUtils.cs @@ -12,10 +12,6 @@ internal static class WindowsUtils { private static readonly string _tag = "WindowsUtils"; - /// - /// 获取剪贴板数 - /// - /// public static string? GetClipboardData() { var strData = string.Empty; @@ -35,10 +31,6 @@ internal static class WindowsUtils return strData; } - /// - /// 拷贝至剪贴板 - /// - /// public static void SetClipboardData(string strData) { try