Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3d462c4

Browse files
committedMay 8, 2025·
1 parent 82b366c commit 3d462c4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed
 

‎v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,14 +1088,11 @@ private async Task<int> GenRoutingUserRule(RulesItem item, List<Rule4Sbox> rules
10881088

10891089
if (item.Port.IsNotEmpty())
10901090
{
1091-
if (item.Port.Contains("-"))
1092-
{
1093-
rule.port_range = new List<string> { item.Port.Replace("-", ":") };
1094-
}
1095-
else
1096-
{
1097-
rule.port = new List<int> { item.Port.ToInt() };
1098-
}
1091+
var portRanges = item.Port.Split(',').Where(it => it.Contains('-')).Select(it => it.Replace("-", ":")).ToList();
1092+
var ports = item.Port.Split(',').Where(it => !it.Contains('-')).Select(it => it.ToInt()).ToList();
1093+
1094+
rule.port_range = portRanges.Count > 0 ? portRanges : null;
1095+
rule.port = ports.Count > 0 ? ports : null;
10991096
}
11001097
if (item.Network.IsNotEmpty())
11011098
{

0 commit comments

Comments
 (0)
Please sign in to comment.