2dust 2025-05-08 15:56:52 +08:00
parent 82b366cd9b
commit 3d462c4be3
1 changed files with 5 additions and 8 deletions

View File

@ -1088,14 +1088,11 @@ public class CoreConfigSingboxService
if (item.Port.IsNotEmpty())
{
if (item.Port.Contains("-"))
{
rule.port_range = new List<string> { item.Port.Replace("-", ":") };
}
else
{
rule.port = new List<int> { item.Port.ToInt() };
}
var portRanges = item.Port.Split(',').Where(it => it.Contains('-')).Select(it => it.Replace("-", ":")).ToList();
var ports = item.Port.Split(',').Where(it => !it.Contains('-')).Select(it => it.ToInt()).ToList();
rule.port_range = portRanges.Count > 0 ? portRanges : null;
rule.port = ports.Count > 0 ? ports : null;
}
if (item.Network.IsNotEmpty())
{