RateShield CLI
#python#automation#microsaas
Sostituisci i gateway SaaS da $20–$150/mese con RateShield CLI: un reverse proxy in Go senza dipendenze per rate limiting API sub-millisecondo, bot tarpitting e difesa da attacchi brute-force. Elimina Redis esterno grazie allo storage embedded, al JA3 fingerprinting e agli alert webhook. Template Docker hardened e binari multi-arch inclusi.
Leggi l'approfondimento tecnicoBasta Gateway SaaS: Protezione API Sub-Millisecondo con RateShield CLImain.pymain.py — estratto d'esempio nello stile del tool
#!/usr/bin/env python3
"""
RateShield CLI
A zero-dependency control plane and management utility for the RateShield
high-performance reverse proxy. Manages local embedded storage engines,
JA3 fingerprint rules, tarpitting thresholds, and automated webhook alerts.
Features:
- Sub-millisecond API rate limiting and token bucket orchestration
- Bot tarpitting and dynamic TCP delay strategy configuration
- JA3 TLS fingerprinting rule generation and enforcement
- Embedded zero-external-dependency key-value store state inspection
- Real-time alert dispatching for brute-force attack vectors
Usage:
$ rateshield daemon start --config /etc/rateshield.json
$ rateshield rules add --ip 192.168.1.1 --action tarpit --delay-ms 500
$ rateshield status --format json
"""
from dataclasses import dataclass, field
from enum import Enum, auto
from typing import Dict, List, Optional, Tuple
import json
import os
import sys
import time
class DefenseAction(Enum):
"""Supported mitigation actions for matching traffic rules."""
ALLOW = auto()
BLOCK = auto()
TARPIT = auto()
CHALLENGE = auto()
@dataclass(frozen=True)
class RateLimitConfig:
"""Configuration parameters for endpoint token bucket rate limiters."""
requests_per_second: int
burst_capacity: int
tarpit_delay_ms: int = 1000
action: DefenseAction = DefenseAction.TARPIT
class RateShieldEngine:
"""Core control plane engine supervising local runtime proxy instances."""
def __init__(self, config_path: str) -> None:
self.config_path: str = config_path
self.rules: List[RateLimitConfig] = []
# ... the full file ships with your download