service: add limiter.scope option

This commit is contained in:
ginuerzh
2025-01-20 23:22:58 +08:00
parent bf36bdc680
commit 379d9a73ad
80 changed files with 374 additions and 685 deletions
+9 -12
View File
@@ -14,13 +14,15 @@ const (
)
type metadata struct {
probeResistance *probeResistance
header http.Header
hash string
authBasicRealm string
observerPeriod time.Duration
observerResetTraffic bool
probeResistance *probeResistance
header http.Header
hash string
authBasicRealm string
observerPeriod time.Duration
observerResetTraffic bool
limiterRefreshInterval time.Duration
limiterCleanupInterval time.Duration
}
func (h *http2Handler) parseMetadata(md mdata.Metadata) error {
@@ -54,12 +56,7 @@ func (h *http2Handler) parseMetadata(md mdata.Metadata) error {
h.md.observerResetTraffic = mdutil.GetBool(md, "observer.resetTraffic")
h.md.limiterRefreshInterval = mdutil.GetDuration(md, "limiter.refreshInterval")
if h.md.limiterRefreshInterval == 0 {
h.md.limiterRefreshInterval = 30 * time.Second
}
if h.md.limiterRefreshInterval < time.Second {
h.md.limiterRefreshInterval = time.Second
}
h.md.limiterCleanupInterval = mdutil.GetDuration(md, "limiter.cleanupInterval")
return nil
}