diff --git a/component/outbound/filter.go b/component/outbound/filter.go index 94265d7..be83788 100644 --- a/component/outbound/filter.go +++ b/component/outbound/filter.go @@ -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) diff --git a/config/config.go b/config/config.go index b6ca01c..a2b0fdd 100644 --- a/config/config.go +++ b/config/config.go @@ -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:""` }