-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rate limit #2674
Add rate limit #2674
Conversation
such as v2ray-core/infra/conf/router.go Lines 15 to 18 in 90a61a5
|
The unit is KB/s, if you need, I can add the readable format feature. Please add it under policy - level |
Please add formatting and move to https://github.com/v2fly/v2ray-core |
What is the difference between v2ray and v2fly? |
v2ray is dead. Long live v2fly. |
多用户 有内存泄露问题 |
临时做了一个,没有做安全考虑,之后有时间会写个优化的。 |
rate.go import ( type Writer struct { func RateWriter(writer buf.Writer, limiter *ratelimit.Bucket) buf.Writer { func (w *Writer) Close() error { func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error { default.go if p.Buffer.Rate != 0 { |
我修改了一版 测试下来 没啥问题 |
@HikaruChang 感谢作者付出,能正常使用,发现限速后,每隔一分钟左右网速会突然窜高,几秒钟后恢复正常,一直循环此过程 |
@zhaoyadong00 试了下你的修改版,限速单位跟原作者的一样吗,我测试后大部分时间基本没速度,有时又突然窜高 |
func (l *RateLimiter) RateWait(count int64) { |
单位不一样 等等 会在发一个稳定版本 |
rate.go 新增 func (b *BucketManage) GetUserBucket(u *protocol.MemoryUser, rate int64) ratelimit.Bucket { var newBucketMange *BucketManage func init() { default.go 更新 bm := NewBucketMange() |
@zhaoyadong00 水桶算法可以正常工做了,另外请教下动态添加 routing rules 有办法实现吗, 比如下面三条 blocked 的tag 实时的添加到路由规则并生效 |
看了下 需要操作添加一下rpc接口 操作Router.rules 这个slice |
学习了,感谢指正 |
此pr的作者还在工作为此吗? |
Add rate limit feature, but I don't know how to get the value from level entry.
"levels": {
"0": {
...
"rate": 100
}
}