流量统计

This commit is contained in:
qaq
2025-06-23 19:07:53 +08:00
parent a2c60d1812
commit f3e9b31ed3
12 changed files with 1831 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
package traffic
import (
limiter "github.com/go-gost/core/limiter/traffic"
)
type limitGenerator struct {
in int
out int
}
func newLimitGenerator(in, out int) *limitGenerator {
return &limitGenerator{
in: in,
out: out,
}
}
func (p *limitGenerator) In() limiter.Limiter {
if p == nil || p.in <= 0 {
return nil
}
return NewLimiter(p.in)
}
func (p *limitGenerator) Out() limiter.Limiter {
if p == nil || p.out <= 0 {
return nil
}
return NewLimiter(p.out)
}