MCPcopy Create free account
hub / github.com/4n0nymou3/Telegram-API-Proxy / validateBotToken

Function validateBotToken

worker.js:745–765  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

743 if (now >= data.resetTime) map.delete(key);
744 }
745 }
746}
747
748function getCount(map, key, now, win) {
749 const d = map.get(key);
750 return (!d || now >= d.resetTime) ? 0 : d.count;
751}
752
753function incCount(map, key, now, win) {
754 const e = map.get(key);
755 if (!e || now >= e.resetTime) map.set(key, { count: 1, resetTime: now + win });
756 else e.count++;
757}
758
759function checkCircuitBreaker(clientIP) {
760 const b = circuitBreakers.get(clientIP);
761 if (!b) return 'CLOSED';
762
763 const now = Date.now();
764
765 if (b.state === 'OPEN') {
766 if (now - b.lastFailureTime >= CIRCUIT_BREAKER.TIMEOUT) {
767 b.state = 'HALF_OPEN';
768 b.halfOpenAttempts = 0;

Callers 1

handleProxyRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected