dnslog 简单实现

This commit is contained in:
Shikong 2023-03-24 16:17:50 +08:00
parent 1245ea1a08
commit d9e7e06482

View File

@ -4,17 +4,24 @@ import (
"encoding/hex" "encoding/hex"
gonanoid "github.com/matoous/go-nanoid" gonanoid "github.com/matoous/go-nanoid"
"matrix-common/pkg/logger" "matrix-common/pkg/logger"
"time"
"fmt" "fmt"
"math" "math"
"net" "net"
"strings"
"testing" "testing"
) )
func TestBatchLookup(t *testing.T) {
for i := 0; i < 10; i++ {
TestLookup(t)
time.Sleep(1 * time.Second)
}
}
func TestLookup(t *testing.T) { func TestLookup(t *testing.T) {
id, _ := gonanoid.Generate("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 6) id, _ := gonanoid.Generate("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 6)
originalText := strings.Repeat("1234567890", 66) originalText := time.Now().Format("2006-01-02 15:04:05.000")
text := hex.EncodeToString([]byte(originalText)) text := hex.EncodeToString([]byte(originalText))