Bug修复+流量限制+带宽限制

This commit is contained in:
刘河
2019-01-28 14:45:55 +08:00
parent 2af7b3d737
commit eccf1dbfb8
22 changed files with 316 additions and 125 deletions

23
utils/rate_test.go Normal file
View File

@@ -0,0 +1,23 @@
package utils
import (
"log"
"testing"
)
var rate = NewRate(100 * 1024)
func TestRate_Get(t *testing.T) {
rate.Start()
for i := 0; i < 5; i++ {
go test(i)
}
test(5)
}
func test(i int) {
for {
rate.Get(64 * 1024)
log.Println("get ok", i)
}
}