MCPcopy Create free account
hub / github.com/F12FLASH/CTF / getRateLimitIdentifier

Function getRateLimitIdentifier

4.Stackless Stack/server/routes.ts:17–25  ·  view source on GitHub ↗
(req: Request)

Source from the content-addressed store, hash-verified

15}
16
17function getRateLimitIdentifier(req: Request): string {
18 if (req.session?.id) {
19 return `session:${req.session.id}`;
20 }
21 const ip = (req.headers['x-forwarded-for'] as string)?.split(',')[0]?.trim() ||
22 req.socket.remoteAddress ||
23 'unknown';
24 return `ip:${ip}`;
25}
26
27function rateLimit(maxRequests: number, windowMs: number) {
28 return (req: Request, res: Response, next: NextFunction) => {

Callers 1

rateLimitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected