Skip to content

Commit

Permalink
修复了修改其他逻辑时,导致 TLD 后缀提取逻辑失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
KincaidYang committed Jan 24, 2024
1 parent 230c17f commit 8628faa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
domain = mainDomain

// 如果结果不符合预期(例如 "com.cn"),则从右向左读取域名,将第一个点右边的部分作为 TLD
if strings.Contains(tld, ".") {
parts := strings.Split(mainDomain, ".")
tld = parts[len(parts)-1]
}

// Cache
cacheKeyPrefix := "whois:"
key := fmt.Sprintf("%s%s", cacheKeyPrefix, domain)
cacheResult, err := redisClient.Get(ctx, key).Result()
Expand Down

0 comments on commit 8628faa

Please sign in to comment.