feat: evolve rate-filter to a more generic filter

This commit is contained in:
2026-07-28 20:40:12 +08:00
parent a3e3079af1
commit b206594eb8
15 changed files with 492 additions and 193 deletions

View File

@ -51,6 +51,23 @@ func popFirstProxyGroup(data map[string]interface{}) map[string]interface{} {
// folding every merged subscription's default selector group together.
const selectionGroupName = "Proxy Selection"
// rewritePoppedGroupRef reflects, in a subscription's own proxy-group refs,
// that its first group was just popped off (via popFirstProxyGroup) to be
// folded into the shared selectionGroupName group by mergeProxySelection —
// so an ssm rule matching this subscription's original default-selector
// name (e.g. via match.name-pattern) resolves to the DisplayName that will
// actually exist in the final config, not one that's about to disappear.
// groupRefs must be in the same order popFirstProxyGroup pops from (i.e.
// straight from automation.PrefixProxyNames), so index 0 is always the
// popped group. No-op if groupRefs is empty.
func rewritePoppedGroupRef(groupRefs []automation.ProxyRef) []automation.ProxyRef {
if len(groupRefs) == 0 {
return groupRefs
}
groupRefs[0].DisplayName = selectionGroupName
return groupRefs
}
// mergeProxySelection collapses each subscription's default selector group
// (already popped off by popFirstProxyGroup) into a single combined group
// named selectionGroupName, covering every subscription's proxies, and