mirror of
https://github.com/WorldEditAxe/eaglerproxy.git
synced 2024-12-22 07:14:13 -08:00
Switched to literal regex notation for some MOTD logic, no temp object on ping
This commit is contained in:
parent
c0bf9b3254
commit
cd9f8756ee
|
@ -30,6 +30,7 @@ import { SkinServer } from "./skins/SkinServer.js";
|
||||||
|
|
||||||
let instanceCount = 0;
|
let instanceCount = 0;
|
||||||
const chalk = new Chalk({ level: 2 });
|
const chalk = new Chalk({ level: 2 });
|
||||||
|
const motdMatcher = /accept: motd/i;
|
||||||
|
|
||||||
export class Proxy extends EventEmitter {
|
export class Proxy extends EventEmitter {
|
||||||
public packetRegistry: Map<
|
public packetRegistry: Map<
|
||||||
|
@ -189,7 +190,7 @@ export class Proxy extends EventEmitter {
|
||||||
}
|
}
|
||||||
}, this.LOGIN_TIMEOUT);
|
}, this.LOGIN_TIMEOUT);
|
||||||
try {
|
try {
|
||||||
if (new RegExp("accept: motd", "i").test(firstPacket.toString())) {
|
if (motdMatcher.test(firstPacket.toString())) {
|
||||||
if (!this.ratelimit.motd.consume(req.socket.remoteAddress).success) {
|
if (!this.ratelimit.motd.consume(req.socket.remoteAddress).success) {
|
||||||
return ws.close();
|
return ws.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user