@quxiy/status-checker
v1.0.2
Published
A robust status checker for FiveM servers and web endpoints.
Maintainers
Readme
Universal Status Checker
A robust, lightweight, and batch-processing status monitor for FiveM servers, Websites, and APIs. Built with TypeScript, zero-dependencies (core), and designed for high performance.
🚀 Features
- Batch Processing: Scans nodes in chunks to prevent network congestion.
- Universal Support: Works with FiveM (JSON), HTTP/HTTPS Websites, and APIs.
- Caching System: Built-in TTL caching to reduce load on target servers.
- Dev-Friendly: JSDoc support and strict typing.
- Safety Mode: Blocks local/private IPs by default (configurable).
📦 Installation
npm install @quxiy/status-checker⚡ Quick Start
const { Monitor } = require('@quxiy/status-checker');
// 1. ตั้งค่า Node ที่ต้องการเช็ค
const nodes = [
{ id: 'sv-1', type: 'fivem', addr: 'sv1.stcom.me:30120', tag: 'Roleplay', name: 'Server 1' },
{ id: 'web-1', type: 'website', addr: 'https://google.com', tag: 'Web', name: 'Google' }
];
// 2. สร้าง Monitor instance
const monitor = new Monitor(nodes, {
wait: 5000, // รอ 5 วิ
debug: true // เปิดดู Log
});
// 3. แจ้งเตือนเมื่อสถานะเปลี่ยน
monitor.on('status-change', (node, oldState, newState) => {
console.log(`[ALERT] ${node.name} state changed from ${oldState.toUpperCase()} to ${newState.toUpperCase()}!`);
});
// 4. ดูรายงานเมื่อเช็คเสร็จ
monitor.on('scan-end', (report) => {
console.log(`Scan completed at ${report.time}`);
});
// 5. เริ่มทำงาน (เช็คทุกๆ 60 วินาที)
monitor.start(60000);⚙️ Configuration
| Option | Type | Default | Description |
| -------- | ------- | ------- | ----------- |
| wait | number | 5000 | Request timeout in milliseconds. |
| ttl | number | 10000 | Cache duration in milliseconds. |
| batch | number | 10 | Number of concurrent requests. |
| unsafe | boolean | false | Set true to allow scanning localhost/private IPs. |
| retries | number | 1 | Number of retry attempts before marking as down. |
| debug | boolean | false | Enable verbose logging to console for debugging. |
| headers | object | {} | Global custom HTTP headers (e.g., User-Agent). |
📝 License
MIT © Likit Phongsakaew
