feat: support no group filter

This commit is contained in:
mzz2017 2023-02-12 11:17:10 +08:00
parent a10a8fd643
commit 448debd620
2 changed files with 6 additions and 1 deletions

View File

@ -51,6 +51,11 @@ func NewDialerSetFromLinks(option *dialer.GlobalOption, tagToNodeList map[string
}
func (s *DialerSet) filterHit(dialer *dialer.Dialer, filters []*config_parser.Function) (hit bool, err error) {
if len(filters) == 0 {
// No filter.
return true, nil
}
// Example
// filter: name(regex:'^.*hk.*$', keyword:'sg') && name(keyword:'disney')
// filter: !name(regex: 'HK|TW|SG') && name(keyword: disney)

View File

@ -32,7 +32,7 @@ type Group struct {
}
type GroupParam struct {
Filter []*config_parser.Function `mapstructure:"filter" required:""`
Filter []*config_parser.Function `mapstructure:"filter"`
Policy interface{} `mapstructure:"policy" required:""`
}