fix: UrlTest's torch not work

close #232
This commit is contained in:
wwqgtxx 2022-10-31 16:45:14 +08:00
parent a7aa5fd523
commit 972d3f1d39
3 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,12 @@ func NewGroupBase(opt GroupBaseOption) *GroupBase {
return gb
}
func (gb *GroupBase) Touch() {
for _, pd := range gb.providers {
pd.Touch()
}
}
func (gb *GroupBase) GetProxies(touch bool) []C.Proxy {
if len(gb.filterRegs) == 0 {
var proxies []C.Proxy

View File

@ -61,6 +61,9 @@ func (u *URLTest) Unwrap(metadata *C.Metadata, touch bool) C.Proxy {
}
func (u *URLTest) fast(touch bool) C.Proxy {
if touch {
u.Touch()
}
elm, _, _ := u.fastSingle.Do(func() (C.Proxy, error) {
proxies := u.GetProxies(touch)
fast := proxies[0]

View File

@ -112,6 +112,7 @@ type ProxyAdapter interface {
type Group interface {
URLTest(ctx context.Context, url string) (mp map[string]uint16, err error)
GetProxies(touch bool) []Proxy
Touch()
}
type DelayHistory struct {