MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / RecentRequestsSnapshot

Method RecentRequestsSnapshot

sdk/cliproxy/auth/types.go:237–259  ·  view source on GitHub ↗
(now time.Time)

Source from the content-addressed store, hash-verified

235}
236
237func (a *Auth) RecentRequestsSnapshot(now time.Time) []RecentRequestBucket {
238 out := make([]RecentRequestBucket, 0, recentRequestBucketCount)
239 if a == nil {
240 return out
241 }
242
243 currentBucketID := recentRequestBucketID(now)
244 for i := recentRequestBucketCount - 1; i >= 0; i-- {
245 bucketID := currentBucketID - int64(i)
246 idx := recentRequestBucketIndex(bucketID)
247 bucket := a.recentRequests.buckets[idx]
248 entry := RecentRequestBucket{
249 Time: formatRecentRequestBucketLabel(bucketID),
250 }
251 if bucket.bucketID == bucketID {
252 entry.Success = bucket.success
253 entry.Failed = bucket.failed
254 }
255 out = append(out, entry)
256 }
257
258 return out
259}
260
261// Clone shallow copies the Auth structure, duplicating maps to avoid accidental mutation.
262func (a *Auth) Clone() *Auth {

Calls 3

recentRequestBucketIDFunction · 0.85
recentRequestBucketIndexFunction · 0.85