1.1.4
This commit is contained in:
parent
541a6a52ee
commit
3ec2d702b4
3 changed files with 9 additions and 6 deletions
9
index.js
9
index.js
|
|
@ -122,7 +122,6 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro
|
|||
const userIp = clientIp.getAddress();
|
||||
if (!userIp) log('warn', `Your IP address is missing! Received: ${userIp}`);
|
||||
|
||||
let reportedIPs = readReportedIPs();
|
||||
let cycleImageSkippedCount = 0, cycleProcessedCount = 0, cycleReportedCount = 0, cycleSkippedCount = 0;
|
||||
const cycleErrorCounts = { blocked: 0, noResponse: 0, otherErrors: 0 };
|
||||
let imageRequestLogged = false;
|
||||
|
|
@ -130,7 +129,13 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro
|
|||
for (const event of blockedIPEvents) {
|
||||
cycleProcessedCount++;
|
||||
const ip = event.clientIP;
|
||||
if (ip === userIp) {
|
||||
log('log', `The IP address ${ip} belongs to this machine. Ignoring...`);
|
||||
cycleSkippedCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const reportedIPs = readReportedIPs();
|
||||
const { recentlyReported, timeDifference } = isIPReportedRecently(event.rayName, ip, reportedIPs);
|
||||
if (recentlyReported) {
|
||||
const hoursAgo = Math.floor(timeDifference / (1000 * 60 * 60));
|
||||
|
|
@ -156,8 +161,6 @@ const reportIP = async (event, country, hostname, endpoint, userAgent, cycleErro
|
|||
if (wasReported) {
|
||||
cycleReportedCount++;
|
||||
await new Promise(resolve => setTimeout(resolve, SUCCESS_COOLDOWN_MS));
|
||||
} else {
|
||||
reportedIPs = readReportedIPs();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "cf-waf-to-abuseipdb",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cf-waf-to-abuseipdb",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.7",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cf-waf-to-abuseipdb",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"description": "A Node.js project that enables automatic reporting of incidents detected by Cloudflare WAF to the AbuseIPDB database.",
|
||||
"keywords": [
|
||||
"abuseipdb",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue