mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-04 19:04:00 +00:00
Chore: remove reduce regex compile (#1855)
This commit is contained in:
parent
ee6fc12709
commit
14ae87fcd0
1 changed files with 2 additions and 2 deletions
|
@ -97,7 +97,8 @@ func stopProxyProvider(pd *ProxySetProvider) {
|
|||
}
|
||||
|
||||
func NewProxySetProvider(name string, interval time.Duration, filter string, vehicle types.Vehicle, hc *HealthCheck) (*ProxySetProvider, error) {
|
||||
if _, err := regexp.Compile(filter); err != nil {
|
||||
filterReg, err := regexp.Compile(filter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid filter regex: %w", err)
|
||||
}
|
||||
|
||||
|
@ -127,7 +128,6 @@ func NewProxySetProvider(name string, interval time.Duration, filter string, veh
|
|||
}
|
||||
|
||||
proxies := []C.Proxy{}
|
||||
filterReg := regexp.MustCompile(filter)
|
||||
for idx, mapping := range schema.Proxies {
|
||||
if name, ok := mapping["name"]; ok && len(filter) > 0 && !filterReg.MatchString(name.(string)) {
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue