mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +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;
|
||||
if (
|
||||
blockedCIDRs.length === 0 ||
|
||||
blockedCIDRObjects.some((cidr) => cidr.contains(ip))
|
||||
(ip && blockedCIDRObjects.some((cidr) => cidr.contains(ip)))
|
||||
) {
|
||||
next()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user