router handler: add cache for sd service
This commit is contained in:
@@ -20,9 +20,9 @@ import (
|
||||
"github.com/go-gost/relay"
|
||||
ctxvalue "github.com/go-gost/x/ctx"
|
||||
xnet "github.com/go-gost/x/internal/net"
|
||||
limiter_util "github.com/go-gost/x/internal/util/limiter"
|
||||
stats_util "github.com/go-gost/x/internal/util/stats"
|
||||
rate_limiter "github.com/go-gost/x/limiter/rate"
|
||||
cache_limiter "github.com/go-gost/x/limiter/traffic/cache"
|
||||
xrecorder "github.com/go-gost/x/recorder"
|
||||
"github.com/go-gost/x/registry"
|
||||
xservice "github.com/go-gost/x/service"
|
||||
@@ -123,10 +123,10 @@ func (h *tunnelHandler) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
|
||||
if h.options.Limiter != nil {
|
||||
h.limiter = limiter_util.NewCachedTrafficLimiter(h.options.Limiter,
|
||||
limiter_util.RefreshIntervalOption(h.md.limiterRefreshInterval),
|
||||
limiter_util.CleanupIntervalOption(h.md.limiterCleanupInterval),
|
||||
limiter_util.ScopeOption(limiter.ScopeClient),
|
||||
h.limiter = cache_limiter.NewCachedTrafficLimiter(h.options.Limiter,
|
||||
cache_limiter.RefreshIntervalOption(h.md.limiterRefreshInterval),
|
||||
cache_limiter.CleanupIntervalOption(h.md.limiterCleanupInterval),
|
||||
cache_limiter.ScopeOption(limiter.ScopeClient),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user