enable custom config tests

This commit is contained in:
Alireza 2024-03-23 01:37:25 +01:00
parent 9b8c59f888
commit 11ca5fd4f2
3 changed files with 34 additions and 26 deletions

View file

@ -1,5 +1,6 @@
using System.Net;
using System.Net.NetworkInformation;
using System.Windows;
using v2rayN.Model;
using v2rayN.Resx;
@ -942,10 +943,6 @@ namespace v2rayN.Handler
foreach (var it in selecteds)
{
if (it.configType == EConfigType.Custom)
{
continue;
}
if (it.port <= 0)
{
continue;
@ -1013,7 +1010,38 @@ namespace v2rayN.Handler
}
var outbound = JsonUtile.Deserialize<Outbounds4Ray>(txtOutbound);
GenOutbound(item, outbound);
if (it.configType == EConfigType.Custom)
{
var fileContent = Utile.LoadResource(Utile.GetConfigPath(it.address));
if (fileContent == null)
{
continue;
}
var fileConfig = JsonUtile.Deserialize<V2rayConfig>(fileContent);
var fileOutbounds = fileConfig.outbounds;
if (fileOutbounds.Count == 0)
{
continue;
}
outbound = fileOutbounds[0];
var outboundDialerProxy = outbound.streamSettings?.sockopt?.dialerProxy;
if (outboundDialerProxy != null)
{
foreach (var otherOutbound in fileOutbounds)
{
if (otherOutbound.tag == outboundDialerProxy)
{
otherOutbound.tag = "dialer" + inbound.port.ToString();
outbound.streamSettings.sockopt.dialerProxy = otherOutbound.tag;
v2rayConfig.outbounds.Add(otherOutbound);
break;
}
}
}
} else {
GenOutbound(item, outbound);
}
outbound.tag = Global.ProxyTag + inbound.port.ToString();
v2rayConfig.outbounds.Add(outbound);

View file

@ -30,10 +30,6 @@ namespace v2rayN.Handler
_selecteds = new List<ServerTestItem>();
foreach (var it in selecteds)
{
if (it.configType == EConfigType.Custom)
{
continue;
}
if (it.port <= 0)
{
continue;
@ -97,10 +93,6 @@ namespace v2rayN.Handler
List<Task> tasks = [];
foreach (var it in _selecteds)
{
if (it.configType == EConfigType.Custom)
{
continue;
}
tasks.Add(Task.Run(() =>
{
try
@ -154,10 +146,6 @@ namespace v2rayN.Handler
{
continue;
}
if (it.configType == EConfigType.Custom)
{
continue;
}
tasks.Add(Task.Run(async () =>
{
try
@ -236,10 +224,6 @@ namespace v2rayN.Handler
{
continue;
}
if (it.configType == EConfigType.Custom)
{
continue;
}
//if (it.delay < 0)
//{
// UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip);
@ -310,10 +294,6 @@ namespace v2rayN.Handler
{
continue;
}
if (it.configType == EConfigType.Custom)
{
continue;
}
if (it.delay < 0)
{
UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip);

View file

@ -1179,7 +1179,7 @@ namespace v2rayN.ViewModels
public void TestServerAvailability()
{
var item = ConfigHandler.GetDefaultServer(_config);
if (item == null || item.configType == EConfigType.Custom)
if (item == null)
{
return;
}