Skip to content

Commit 66e1aea

Browse files
authored
Fix speedtest core type (2dust#8900)
* Fix speedtest core type * Simplify code
1 parent e03c220 commit 66e1aea

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public static async Task<CoreConfigContextBuilderAllResult> BuildAll(Config conf
268268
{
269269
IndexId = $"inner-{Utils.GetGuid(false)}",
270270
ConfigType = EConfigType.ProxyChain,
271-
CoreType = node.CoreType ?? ECoreType.Xray,
271+
CoreType = AppManager.Instance.GetCoreType(node, node.ConfigType),
272272
};
273273
List<string?> childItems = [prevNode?.IndexId, node.IndexId, nextNode?.IndexId];
274274
var chainExtraItem = chainNode.GetProtocolExtra() with

v2rayN/ServiceLib/Handler/CoreConfigHandler.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static async Task<RetResult> GenerateClientConfig(CoreConfigContext conte
2121
_ => await GenerateClientCustomConfig(node, fileName)
2222
};
2323
}
24-
else if (AppManager.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box)
24+
else if (context.RunCoreType == ECoreType.sing_box)
2525
{
2626
result = new CoreConfigSingboxService(context).GenerateClientConfigContent();
2727
}
@@ -128,12 +128,11 @@ public static async Task<RetResult> GenerateClientSpeedtestConfig(Config config,
128128
public static async Task<RetResult> GenerateClientSpeedtestConfig(Config config, CoreConfigContext context, ServerTestItem testItem, string fileName)
129129
{
130130
var result = new RetResult();
131-
var node = context.Node;
132131
var initPort = AppManager.Instance.GetLocalPort(EInboundProtocol.speedtest);
133132
var port = Utils.GetFreePort(initPort + testItem.QueueNum);
134133
testItem.Port = port;
135134

136-
if (AppManager.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box)
135+
if (context.RunCoreType == ECoreType.sing_box)
137136
{
138137
result = new CoreConfigSingboxService(context).GenerateClientSpeedtestConfig(port);
139138
}

v2rayN/ServiceLib/Manager/CoreManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public async Task LoadCore(CoreConfigContext? mainContext, CoreConfigContext? pr
132132
return null;
133133
}
134134

135-
var coreType = AppManager.Instance.GetCoreType(node, node.ConfigType);
135+
var coreType = context.RunCoreType;
136136
var coreInfo = CoreInfoManager.Instance.GetCoreInfo(coreType);
137137
return await RunProcess(coreInfo, fileName, true, false);
138138
}

0 commit comments

Comments
 (0)