16
EXAMPLES.md
16
EXAMPLES.md
@@ -76,7 +76,7 @@ curl -X GET http://localhost:3000/api/status
|
||||
### Rate Limit Excedido
|
||||
|
||||
```bash
|
||||
# Después de 10 requests en 1 minuto
|
||||
# Después de 5 requests en 10 minutos
|
||||
curl -X POST http://localhost:3000/api/ping \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"target": "8.8.8.8"}'
|
||||
@@ -87,8 +87,8 @@ curl -X POST http://localhost:3000/api/ping \
|
||||
{
|
||||
"error": "Rate limit exceeded",
|
||||
"message": "Too many requests. Please try again later.",
|
||||
"resetTime": 1692180660000,
|
||||
"limit": 10,
|
||||
"resetTime": 1692181260000,
|
||||
"limit": 5,
|
||||
"remaining": 0
|
||||
}
|
||||
```
|
||||
@@ -211,7 +211,7 @@ async function checkRateLimit() {
|
||||
const rateLimit = data.clientInfo.rateLimit;
|
||||
console.log(`Rate Limit: ${rateLimit.remaining}/${rateLimit.limit} remaining`);
|
||||
|
||||
if (rateLimit.remaining < 3) {
|
||||
if (rateLimit.remaining < 2) {
|
||||
console.warn('⚠️ Approaching rate limit!');
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ if result:
|
||||
status = client.get_status()
|
||||
if status:
|
||||
print(f"Service: {status['service']}")
|
||||
print(f"Rate limit: {status['clientInfo']['rateLimit']['remaining']}/10")
|
||||
print(f"Rate limit: {status['clientInfo']['rateLimit']['remaining']}/5")
|
||||
```
|
||||
|
||||
### 2. Monitor Continuo
|
||||
@@ -349,9 +349,9 @@ curl -I -X POST http://localhost:3000/api/ping \
|
||||
|
||||
**Headers de respuesta:**
|
||||
```
|
||||
X-RateLimit-Limit: 10
|
||||
X-RateLimit-Remaining: 9
|
||||
X-RateLimit-Reset: 1692180660000
|
||||
X-RateLimit-Limit: 5
|
||||
X-RateLimit-Remaining: 4
|
||||
X-RateLimit-Reset: 1692181260000
|
||||
```
|
||||
|
||||
## 🚀 Casos de Uso Avanzados
|
||||
|
||||
Referencia en una nueva incidencia
Block a user