Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
veo committed Nov 3, 2021
1 parent 6a9a013 commit 8ff388d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func HttpRequset(urlstring string, method string, postdata string, isredirect bo
func Dnslogchek(randomstr string) bool {
urlStr := fmt.Sprintf("http://api.ceye.io/v1/records?token=%s&type=dns&filter=%s", CeyeApi, randomstr)
if resp, err := HttpRequset(urlStr, "GET", "", false, nil); err == nil {
if !strings.Contains(resp.Body, `"data": []`) { // api返回结果不为空
if !strings.Contains(resp.Body, `"data": []`) && strings.Contains(resp.Body, `{"code": 200, "message": "OK"}`) { // api返回结果不为空
return true
}
}
Expand All @@ -160,7 +160,7 @@ func Dnslogchek(randomstr string) bool {
func RandomStr() string {
lowercase := "1234567890abcdefghijklmnopqrstuvwxyz"
randSource := rand.New(rand.NewSource(time.Now().Unix()))
const (
var (
letterIdxBits = 6 // 6 bits to represent a letter index
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
Expand All @@ -170,7 +170,7 @@ func RandomStr() string {
if remain == 0 {
cache, remain = randSource.Int63(), letterIdxMax
}
if idx := int(cache & letterIdxMask); idx < len(lowercase) {
if idx := int(cache) & int(letterIdxMask); idx < len(lowercase) {
randBytes[i] = lowercase[idx]
i--
}
Expand Down

0 comments on commit 8ff388d

Please sign in to comment.