fix: proxy-groups filter logic
This commit is contained in:
@ -29,8 +29,9 @@ func getProvidersProxies(providers []provider.ProxyProvider, touch bool, filter
|
||||
//filterReg = regexp.MustCompile(filter)
|
||||
filterReg = regexp2.MustCompile(filter, 0)
|
||||
for _, p := range proxies {
|
||||
if p.Type() < 8 {
|
||||
if p.IsProxyGroup() {
|
||||
matchedProxies = append(matchedProxies, p)
|
||||
continue
|
||||
}
|
||||
|
||||
//if filterReg.MatchString(p.Name()) {
|
||||
|
@ -24,6 +24,10 @@ type Fallback struct {
|
||||
failedTime *atomic.Int64
|
||||
}
|
||||
|
||||
func (f *Fallback) IsProxyGroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (f *Fallback) Now() string {
|
||||
proxy := f.findAliveProxy(false)
|
||||
return proxy.Name()
|
||||
|
@ -28,6 +28,10 @@ type LoadBalance struct {
|
||||
strategyFn strategyFn
|
||||
}
|
||||
|
||||
func (lb *LoadBalance) IsProxyGroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var errStrategy = errors.New("unsupported strategy")
|
||||
|
||||
func parseStrategy(config map[string]any) string {
|
||||
|
@ -19,6 +19,10 @@ type Relay struct {
|
||||
filter string
|
||||
}
|
||||
|
||||
func (r *Relay) IsProxyGroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// DialContext implements C.ProxyAdapter
|
||||
func (r *Relay) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error) {
|
||||
var proxies []C.Proxy
|
||||
|
@ -21,6 +21,10 @@ type Selector struct {
|
||||
providers []provider.ProxyProvider
|
||||
}
|
||||
|
||||
func (s *Selector) IsProxyGroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// DialContext implements C.ProxyAdapter
|
||||
func (s *Selector) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error) {
|
||||
c, err := s.selectedProxy(true).DialContext(ctx, metadata, s.Base.DialOptions(opts...)...)
|
||||
|
@ -35,6 +35,10 @@ type URLTest struct {
|
||||
failedTime *atomic.Int64
|
||||
}
|
||||
|
||||
func (u *URLTest) IsProxyGroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (u *URLTest) Now() string {
|
||||
return u.fast(false).Name()
|
||||
}
|
||||
|
Reference in New Issue
Block a user