package internal import ( "fmt" "math" "matrix-common/pkg/logger" "net" "strings" "testing" ) func TestLookup(t *testing.T) { text := strings.Repeat("1234567890", 66) chunkSize := 10 data := make([]string, 0) fLen := float64(len(text)) / float64(chunkSize) l := int(math.Ceil(fLen)) for i := 0; i < l; i++ { if i == 0 { data = append(data, text[:chunkSize]) } else { if (i+1)*chunkSize > len(text) { data = append(data, text[i*chunkSize:]) } else { data = append(data, text[i*chunkSize:(i+1)*chunkSize]) } } } logger.Log().Infof("%#v", data) for i, datum := range data { _, _ = net.LookupIP(fmt.Sprintf("%s.%s.%d.%s.log.skcks.cn", "a", "1", i, datum)) } _, _ = net.LookupIP(fmt.Sprintf("%s.%s.%s.%s.log.skcks.cn", "e", "1", "x", "x")) }