Go实现接口访问速率限制
接口的访问限制,10分钟内,接口访问限制100次 基于go语言进行编写,抽离出统一配置。 func CheckRateLimit(ip, request, action string) bool { current := int(time.Now().Unix()) currentStr := strconv.Itoa(current) //limit 100次 //timeset 600秒 //限制600秒最多访问100次 limit, timeset := GetRateLimitConfig() allowanceStr, timestampStr := LoadAllowance(ip, request, action) allowance, _ := strconv.Atoi(al...阅读全文