mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-06 13:40:10 +00:00
only record tcp connecting ip on real time
This commit is contained in:
@@ -12,15 +12,24 @@ func init() {
|
||||
}
|
||||
|
||||
func TestConnLimiter_AddConnCount(t *testing.T) {
|
||||
t.Log(c.AddConnCount("1", "1"))
|
||||
t.Log(c.AddConnCount("1", "2"))
|
||||
t.Log(c.AddConnCount("1", "1", true))
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
}
|
||||
|
||||
func TestConnLimiter_DelConnCount(t *testing.T) {
|
||||
t.Log(c.AddConnCount("1", "1"))
|
||||
t.Log(c.AddConnCount("1", "2"))
|
||||
t.Log(c.AddConnCount("1", "1", true))
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
c.DelConnCount("1", "1")
|
||||
t.Log(c.AddConnCount("1", "2"))
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
}
|
||||
|
||||
func TestConnLimiter_ClearPacketOnlineIP(t *testing.T) {
|
||||
t.Log(c.AddConnCount("1", "1", false))
|
||||
t.Log(c.AddConnCount("1", "2", false))
|
||||
c.ClearPacketOnlineIP()
|
||||
t.Log(c.AddConnCount("1", "2", true))
|
||||
c.DelConnCount("1", "2")
|
||||
t.Log(c.AddConnCount("1", "1", false))
|
||||
}
|
||||
|
||||
func BenchmarkConnLimiter(b *testing.B) {
|
||||
@@ -28,7 +37,7 @@ func BenchmarkConnLimiter(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
c.AddConnCount("1", "2")
|
||||
c.AddConnCount("1", "2", true)
|
||||
c.DelConnCount("1", "2")
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user