mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
update conf, fix tcp count
This commit is contained in:
@@ -3,6 +3,7 @@ package limiter
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var c *ConnLimiter
|
||||
@@ -23,13 +24,21 @@ func TestConnLimiter_DelConnCount(t *testing.T) {
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
}
|
||||
|
||||
func TestConnLimiter_ClearPacketOnlineIP(t *testing.T) {
|
||||
func TestConnLimiter_ClearOnlineIP(t *testing.T) {
|
||||
t.Log(c.AddConnCount("1", "1", false))
|
||||
t.Log(c.AddConnCount("1", "2", false))
|
||||
c.ClearOnlineIP()
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
c.DelConnCount("1", "2")
|
||||
t.Log(c.AddConnCount("1", "1", false))
|
||||
// not realtime
|
||||
c.realtime = false
|
||||
t.Log(c.AddConnCount("3", "2", true))
|
||||
c.ClearOnlineIP()
|
||||
t.Log(c.ip.Load("3"))
|
||||
time.Sleep(time.Minute)
|
||||
c.ClearOnlineIP()
|
||||
t.Log(c.ip.Load("3"))
|
||||
}
|
||||
|
||||
func BenchmarkConnLimiter(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user