This commit is contained in:
UnknownObject
2026-06-30 17:49:51 +08:00
commit 292c09619e
200 changed files with 23718 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "IPTable.h"
IPTable::IPTable()
{
storage.clear();
}
IPTable::IPTable(const IPTable& obj)
{
for (auto& ele : obj.storage)
storage.insert(ele);
}
void IPTable::Appened(DateTime expr_time, IPList list)
{
storage.insert(std::pair<DateTime, IPList>(expr_time, list));
}
void IPTable::Update()
{
DateTime time = DateTime::Now();
for (auto it = storage.begin(); it != storage.end(); it++)
if ((*it).first.GetTimeStamp() <= time.GetTimeStamp())
storage.erase(it);
return;
}
bool IPTable::IPExist(std::string ip)
{
for (auto& ele : storage)
if (ele.second.Exist(ip))
return true;
return false;
}