feat: proxies group URLTest api

This commit is contained in:
adlyq
2022-05-30 21:55:09 +08:00
parent 58d299c737
commit 4092a7c84b
7 changed files with 127 additions and 9 deletions

View File

@ -108,6 +108,11 @@ type ProxyAdapter interface {
Unwrap(metadata *Metadata) Proxy
}
type Group interface {
URLTest(ctx context.Context, url string) (mp map[string]uint16, err error)
GetProxies(touch bool) []Proxy
}
type DelayHistory struct {
Time time.Time `json:"time"`
Delay uint16 `json:"delay"`

View File

@ -1,7 +1,7 @@
package provider
import (
"github.com/Dreamacro/clash/constant"
C "github.com/Dreamacro/clash/constant"
)
// Vehicle Type
@ -65,10 +65,10 @@ type Provider interface {
// ProxyProvider interface
type ProxyProvider interface {
Provider
Proxies() []constant.Proxy
Proxies() []C.Proxy
// ProxiesWithTouch is used to inform the provider that the proxy is actually being used while getting the list of proxies.
// Commonly used in DialContext and DialPacketConn
ProxiesWithTouch() []constant.Proxy
ProxiesWithTouch() []C.Proxy
HealthCheck()
Version() uint
}
@ -100,7 +100,7 @@ func (rt RuleType) String() string {
type RuleProvider interface {
Provider
Behavior() RuleType
Match(*constant.Metadata) bool
Match(*C.Metadata) bool
ShouldResolveIP() bool
AsRule(adaptor string) constant.Rule
AsRule(adaptor string) C.Rule
}