我需要阻止某些IP地址访问我的应用。我需要使用postgres编写查询,以检查IP(动态生成)是否在存储在数据库中的startip和endip之间的任何范围内。
Arr.forEach((element,index)=>{
client.query("select exists(select 1 from data where ip_start=$1 OR ip_end = $2 between ip_start and ip_end)",
[Arr[index].ip,Arr[index].ip])
.then((res =>{console.log(res)
}
))
})