Update CoreConfigSingboxService.cs

This commit is contained in:
2dust 2025-03-03 14:36:01 +08:00
parent 8dcf5c5b90
commit cdc5d72cfa

View file

@ -733,15 +733,10 @@ namespace ServiceLib.Services.CoreConfig
if (node.Ports.IsNotEmpty()) if (node.Ports.IsNotEmpty())
{ {
outbound.server_port = null; outbound.server_port = null;
outbound.server_ports = new List<string>(); outbound.server_ports = node.Ports.Split(',')
var ports = node.Ports.Split(',') .Where(p => p.Trim().IsNotEmpty())
.Select(p => p.Trim()) .Select(p => p.Replace('-', ':'))
.Where(p => !string.IsNullOrEmpty(p))
.ToList(); .ToList();
foreach (var it in ports)
{
outbound.server_ports.Add(it.Contains('-') ? it.Replace('-', ':') : it);
}
outbound.hop_interval = _config.HysteriaItem.HopInterval > 0 ? $"{_config.HysteriaItem.HopInterval}s" : null; outbound.hop_interval = _config.HysteriaItem.HopInterval > 0 ? $"{_config.HysteriaItem.HopInterval}s" : null;
} }