Skip to content

Commit

Permalink
Fix Speedtest bug
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Sep 17, 2024
1 parent a7f3a7b commit cb1f936
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out Sin
{
continue;
}
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (it.configType is EConfigType.VMess or EConfigType.VLESS)
{
var item2 = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item2 is null || Utils.IsNullOrEmpty(item2.id) || !Utils.IsGuidByParse(item2.id))
if (item is null || Utils.IsNullOrEmpty(item.id) || !Utils.IsGuidByParse(item.id))
{
continue;
}
Expand Down Expand Up @@ -178,7 +178,6 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out Sin
singboxConfig.inbounds.Add(inbound);

//outbound
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null)
{
continue;
Expand All @@ -193,6 +192,12 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out Sin
{
continue;
}
if ((it.configType is EConfigType.VLESS or EConfigType.Trojan)
&& item.streamSecurity == Global.StreamSecurityReality
&& item.publicKey.IsNullOrEmpty())
{
continue;
}

var outbound = JsonUtils.Deserialize<Outbound4Sbox>(txtOutbound);
GenOutbound(item, outbound);
Expand Down
11 changes: 8 additions & 3 deletions v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out V2r
{
continue;
}
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (it.configType is EConfigType.VMess or EConfigType.VLESS)
{
var item2 = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item2 is null || Utils.IsNullOrEmpty(item2.id) || !Utils.IsGuidByParse(item2.id))
if (item is null || Utils.IsNullOrEmpty(item.id) || !Utils.IsGuidByParse(item.id))
{
continue;
}
Expand Down Expand Up @@ -294,7 +294,6 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out V2r
v2rayConfig.inbounds.Add(inbound);

//outbound
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null)
{
continue;
Expand All @@ -309,6 +308,12 @@ public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out V2r
{
continue;
}
if ((it.configType is EConfigType.VLESS or EConfigType.Trojan)
&& item.streamSecurity == Global.StreamSecurityReality
&& item.publicKey.IsNullOrEmpty())
{
continue;
}

var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
GenOutbound(item, outbound);
Expand Down

0 comments on commit cb1f936

Please sign in to comment.