mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-18 05:42:03 +01:00
autoclear lastConn
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
5ba3980a9e
commit
e35b1ac584
5
http.js
5
http.js
@ -41,6 +41,11 @@ server.on('request', (req, res) => {
|
||||
});
|
||||
|
||||
server.on('upgrade', (req, sock, head) => {
|
||||
for (i of lastConn) {
|
||||
if (config.incomming_ratelimit > (Date.now() - i[1])) continue;
|
||||
lastConn.delete(i[0]);
|
||||
}
|
||||
|
||||
const ip = req.headers["x-forwarded-for"]?.split(",")[0] || sock.address()?.address;
|
||||
const lv = lastConn.get(ip) // last visit
|
||||
if (config.incomming_ratelimit && (config.incomming_ratelimit > (Date.now() - lv))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user