Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lllshield

All-In-One Anti-DDoS & Rate Limiting Shield for Node.js (Zero Dependencies)
디도스, 광클, API 남용을 한 방에 차단하는 초경량 종합 방어 패키지.


⚡ Features

  • 🛡️ Rate Limiting: Sets max request limits per IP within a custom time window.
  • 🔨 Auto IP Banning: Automatically bans malicious IPs after repeated limit breaches.
  • 🧹 Memory Safe: Built-in auto garbage collection to prevent memory leaks during heavy DDoS traffic.
  • 🔌 Universal Middleware: Seamlessly integrates with Express, Fastify, Next.js, or Native HTTP.
  • 🎈 Zero Dependencies: 100% Native Node.js ESM.

🚀 Installation / 설치

npm install lllshield

⚠️ Prerequisite / 필수 조건: ESM Native ("type": "module" in package.json).

💻 Usage / 사용법

🇺🇸 Express Middleware Usage

import express from 'express';
import { LllShield } from 'lllshield';

const app = express();

// Allow 100 requests per minute.
// If an IP breaches the limit 3 times, ban it for 5 minutes.
const shield = new LllShield({
  windowMs: 60000,    // 1 min
  maxRequests: 100,   // Max requests per window
  banThreshold: 3,    // 3 breaches = BAN
  banDuration: 300000 // 5 mins ban
});

app.use(shield.middleware());

app.get('/api/data', (req, res) => {
  res.send('Safe and Protected Data!');
});

app.listen(3000);

🇰🇷 Standalone / Custom Server Usage

Express 없이 직접 IP 검사만 수행하여 차단할 수도 있습니다.

import { LllShield } from 'lllshield';

const shield = new LllShield({ maxRequests: 50 });

// HTTP 요청 또는 웹소켓 IP 전달
const result = shield.check('192.168.0.1');

if (!result.allowed) {
  console.log(`차단 원인: ${result.reason}`);
  console.log(`재시도 대기시간: ${result.retryAfter}초`);
} else {
  console.log(`남은 요청 횟수: ${result.remaining}`);
}

About

All-In-One Anti-DDoS & Rate Limiting Shield for Node.js (Zero Dependencies)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages