mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 16:30:07 +08:00
Update urltest for test a proxy
鉴于auto规则 失败后很久才能重新访问。提供一个思路和实践:节点失败时单个测速,而不是非要等到健康检查。
This commit is contained in:
parent
ae7967f662
commit
165047acae
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/metacubex/mihomo/common/callback"
|
"github.com/metacubex/mihomo/common/callback"
|
||||||
@ -67,6 +68,11 @@ func (u *URLTest) DialContext(ctx context.Context, metadata *C.Metadata) (c C.Co
|
|||||||
c.AppendToChains(u)
|
c.AppendToChains(u)
|
||||||
} else {
|
} else {
|
||||||
u.onDialFailed(proxy.Type(), err, u.healthCheck)
|
u.onDialFailed(proxy.Type(), err, u.healthCheck)
|
||||||
|
expectedStatus, err := utils.NewUnsignedRanges[uint16](u.expectedStatus)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("DialContext onDialFailed %s: %w", proxy.Name(), err)
|
||||||
|
}
|
||||||
|
proxy.URLTest(ctx, u.testUrl, expectedStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
if N.NeedHandshake(c) {
|
if N.NeedHandshake(c) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user