mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
fix endpoints not being url tested
This commit is contained in:
parent
3179e37ab5
commit
4b3bb5f019
@ -26,6 +26,7 @@ type URLTestResult struct {
|
||||
|
||||
func BatchURLTest(ctx context.Context, i *boxbox.Box, outboundTags []string, url string, maxConcurrency int, twice bool) []*URLTestResult {
|
||||
outbounds := service.FromContext[adapter.OutboundManager](i.Context())
|
||||
endpoints := service.FromContext[adapter.EndpointManager](i.Context())
|
||||
resMap := make(map[string]*URLTestResult)
|
||||
resAccess := sync.Mutex{}
|
||||
limiter := make(chan struct{}, maxConcurrency)
|
||||
@ -49,7 +50,10 @@ func BatchURLTest(ctx context.Context, i *boxbox.Box, outboundTags []string, url
|
||||
defer wg.Done()
|
||||
outbound, found := outbounds.Outbound(t)
|
||||
if !found {
|
||||
panic("no outbound with tag " + t + " found")
|
||||
outbound, found = endpoints.Get(t)
|
||||
if !found {
|
||||
panic("no outbound with tag " + t + " found")
|
||||
}
|
||||
}
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
|
||||
@ -161,6 +161,8 @@ namespace NekoGui {
|
||||
results->error = QString("outbounds is empty for %1").arg(item->bean->name);
|
||||
return results;
|
||||
}
|
||||
auto endpoints = res->coreConfig["endpoints"].toArray();
|
||||
for (auto endpoint : endpoints) outbounds.append(endpoint);
|
||||
for (const auto &outboundRef: outbounds) {
|
||||
auto outbound = outboundRef.toObject();
|
||||
if (outbound["tag"] == "direct" || outbound["tag"] == "block" || outbound["tag"] == "dns-out" || outbound["tag"].toString().startsWith("rout")) continue;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user