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
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"github.com/go-gost/core/limiter"
"github.com/go-gost/core/limiter/traffic"
traffic_limiter "github.com/go-gost/x/limiter/traffic"
)
type listener struct {
@@ -31,7 +32,7 @@ func (ln *listener) Accept() (net.Conn, error) {
return nil, err
}
return WrapConn(c, ln.limiter, "",
return WrapConn(c, ln.limiter, traffic_limiter.ServiceLimitKey,
limiter.ScopeOption(limiter.ScopeService),
limiter.ServiceOption(ln.service),
limiter.NetworkOption(ln.Addr().Network()),