限制同一ip连接的类 更多...
#include <sttnet.h>
Public 成员函数 | |
| ConnectionLimiter (const int &connectionLimit=20, const int &connectionRateLimit=6) | |
| ConnectionLimiter 的构造函数 更多... | |
| bool | allow (const std::string &ip) |
| 根据连接数和速度判断是否允许某ip的连接 更多... | |
| void | clearIP (const std::string &ip) |
| 把记录某ip的连接数清零 更多... | |
限制同一ip连接的类
|
inline |
ConnectionLimiter 的构造函数
| connectionLimit | 同一个ip的最大连接数,默认为20 |
| connectionRateLimit | 同一ip每秒的连接最大次数,默认为6 |
| bool stt::security::ConnectionLimiter::allow | ( | const std::string & | ip | ) |
根据连接数和速度判断是否允许某ip的连接
| ip | ip地址 |
| void stt::security::ConnectionLimiter::clearIP | ( | const std::string & | ip | ) |
把记录某ip的连接数清零
| ip地址 |
1.8.5