feat: evolve rate-filter to a more generic filter
This commit is contained in:
@ -24,18 +24,17 @@ func ParseConfig(raw interface{}) (*Config, error) {
|
||||
}
|
||||
|
||||
// Apply runs every ssm automation rule against finalConfig (the fully
|
||||
// merged generated config, with essential/DNS defaults already applied),
|
||||
// using proxies as the pool collected while merging active subscriptions.
|
||||
// Each rule/patch is independent: one failing doesn't stop the rest, and
|
||||
// all failures are returned as non-fatal errors for the caller to log.
|
||||
// merged generated config — subscription-provided proxy-groups already
|
||||
// merged in, essential/DNS defaults already applied), using proxies as the
|
||||
// pool collected while merging active subscriptions. proxy-groups rules run
|
||||
// first so filters rules can also scrub proxies out of the groups they
|
||||
// build. Each rule/patch is independent: one failing doesn't stop the rest,
|
||||
// and all failures are returned as non-fatal errors for the caller to log.
|
||||
func Apply(finalConfig map[string]interface{}, cfg *Config, proxies []ProxyRef) []error {
|
||||
var errs []error
|
||||
|
||||
buildProxyGroups(finalConfig, cfg.ProxyGroups, proxies)
|
||||
|
||||
if rateErrs := buildRateFilterGroups(finalConfig, cfg.RateFilters, proxies); len(rateErrs) > 0 {
|
||||
errs = append(errs, rateErrs...)
|
||||
}
|
||||
errs = append(errs, buildProxyGroups(finalConfig, cfg.ProxyGroups, proxies)...)
|
||||
errs = append(errs, applyFilters(finalConfig, cfg.Filters, proxies)...)
|
||||
|
||||
for _, patch := range cfg.Patches {
|
||||
if err := applyPatch(finalConfig, patch); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user