MCPcopy Create free account
hub / github.com/codeaashu/claude-code / allow

Method allow

src/server/web/auth.ts:34–49  ·  view source on GitHub ↗

* Returns true if the connection should be allowed.

(ip: string)

Source from the content-addressed store, hash-verified

32 * Returns true if the connection should be allowed.
33 */
34 allow(ip: string): boolean {
35 const now = Date.now();
36 const timestamps = this.attempts.get(ip) ?? [];
37
38 // Prune old entries
39 const recent = timestamps.filter((t) => now - t < this.windowMs);
40
41 if (recent.length >= this.maxPerWindow) {
42 this.attempts.set(ip, recent);
43 return false;
44 }
45
46 recent.push(now);
47 this.attempts.set(ip, recent);
48 return true;
49 }
50
51 /**
52 * Periodically clean up stale entries.

Callers 2

pty-server.tsFile · 0.45
auth.test.tsFile · 0.45

Calls 3

getMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected