优化ip过滤逻辑性能

This commit is contained in:
xia-chu 2023-07-26 16:45:47 +08:00
parent 706c63c64b
commit 22e3872cd4

View File

@ -93,8 +93,8 @@ bool HttpFileManager::isIPAllowed(const std::string &ip) {
if (allow_ip_range.empty()) {
return true;
}
auto ip_int = get_ip_uint64(ip);
for (auto &range : allow_ip_range) {
auto ip_int = get_ip_uint64(ip);
if (ip_int >= range.first && ip_int <= range.second) {
return true;
}