mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-09 06:12:31 +00:00
improve cidr ip blocking
This commit is contained in:
parent
e391b6063f
commit
256d0ba59c
@ -13,7 +13,7 @@ export const createIpWhitelistMiddleware = (blockedCIDRs: string[]) => {
|
|||||||
const ip = req.ip // or req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
const ip = req.ip // or req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||||
if (
|
if (
|
||||||
blockedCIDRs.length === 0 ||
|
blockedCIDRs.length === 0 ||
|
||||||
blockedCIDRObjects.some((cidr) => cidr.contains(ip))
|
(ip && blockedCIDRObjects.some((cidr) => cidr.contains(ip)))
|
||||||
) {
|
) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user