Centralize active network info retrieval

This commit is contained in:
2dust
2026-02-26 17:34:57 +08:00
parent b53507f486
commit 7931058342
8 changed files with 32 additions and 32 deletions
@@ -137,18 +137,8 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
List<IPEndPoint> lstIpEndPoints = new();
List<TcpConnectionInformation> lstTcpConns = new();
try
{
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners());
lstTcpConns.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections());
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
var (lstIpEndPoints, lstTcpConns) = Utils.GetActiveNetworkInfo();
GenLog();
GenMinimizedDns();
@@ -43,6 +43,7 @@ public partial class CoreConfigSingboxService
case EConfigType.PolicyGroup:
proxyOutboundList = BuildOutboundsList(baseTagName);
break;
case EConfigType.ProxyChain:
proxyOutboundList = BuildChainOutboundsList(baseTagName);
break;
@@ -94,18 +94,8 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
List<IPEndPoint> lstIpEndPoints = new();
List<TcpConnectionInformation> lstTcpConns = new();
try
{
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners());
lstTcpConns.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections());
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
var (lstIpEndPoints, lstTcpConns) = Utils.GetActiveNetworkInfo();
GenLog();
_coreConfig.inbounds.Clear();
@@ -68,6 +68,7 @@ public partial class CoreConfigV2rayService
case EConfigType.PolicyGroup:
proxyOutboundList.AddRange(BuildOutboundsList(baseTagName));
break;
case EConfigType.ProxyChain:
proxyOutboundList.AddRange(BuildChainOutboundsList(baseTagName));
break;