fix: exclude-filter not work when filter is empty

This commit is contained in:
gVisor bot 2022-11-09 08:41:30 +08:00
parent a3d4385a90
commit b1802da5ea

View file

@ -71,20 +71,15 @@ func (gb *GroupBase) Touch() {
} }
func (gb *GroupBase) GetProxies(touch bool) []C.Proxy { func (gb *GroupBase) GetProxies(touch bool) []C.Proxy {
if len(gb.filterRegs) == 0 {
var proxies []C.Proxy var proxies []C.Proxy
if len(gb.filterRegs) == 0 {
for _, pd := range gb.providers { for _, pd := range gb.providers {
if touch { if touch {
pd.Touch() pd.Touch()
} }
proxies = append(proxies, pd.Proxies()...) proxies = append(proxies, pd.Proxies()...)
} }
if len(proxies) == 0 { } else {
return append(proxies, tunnel.Proxies()["COMPATIBLE"])
}
return proxies
}
for i, pd := range gb.providers { for i, pd := range gb.providers {
if touch { if touch {
pd.Touch() pd.Touch()
@ -121,10 +116,10 @@ func (gb *GroupBase) GetProxies(touch bool) []C.Proxy {
} }
} }
var proxies []C.Proxy
for _, p := range gb.proxies { for _, p := range gb.proxies {
proxies = append(proxies, p...) proxies = append(proxies, p...)
} }
}
if len(proxies) == 0 { if len(proxies) == 0 {
return append(proxies, tunnel.Proxies()["COMPATIBLE"]) return append(proxies, tunnel.Proxies()["COMPATIBLE"])