实现IP黑白名单、国家|地区封禁、省份封禁

This commit is contained in:
刘祥超
2020-11-09 10:44:00 +08:00
parent 725ff1d9ef
commit e8e1d3a4bd
14 changed files with 187 additions and 22 deletions

View File

@@ -2,13 +2,16 @@ package models
import (
_ "github.com/go-sql-driver/mysql"
"github.com/iwind/TeaGo/dbs"
"runtime"
"testing"
)
func TestIPListDAO_IncreaseVersion(t *testing.T) {
dbs.NotifyReady()
dao := NewIPListDAO()
version, err := dao.IncreaseVersion(1)
version, err := dao.IncreaseVersion()
if err != nil {
t.Fatal(err)
}
@@ -18,8 +21,10 @@ func TestIPListDAO_IncreaseVersion(t *testing.T) {
func BenchmarkIPListDAO_IncreaseVersion(b *testing.B) {
runtime.GOMAXPROCS(1)
dbs.NotifyReady()
dao := NewIPListDAO()
for i := 0; i < b.N; i++ {
_, _ = dao.IncreaseVersion(1)
_, _ = dao.IncreaseVersion()
}
}