endstone::IpBanList
Represents a ban list, containing banned IP addresses.
Bases: endstone::BanList< IpBanEntry >
Functions:
| Name | Description |
|---|---|
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
addBan | Adds a ban to this list. If a previous ban exists, this will update the previous entry. |
getBanEntry | Gets a BanEntry by IP address. |
getBanEntry | Gets a BanEntry by IP address. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
getEntries | Gets a vector containing pointers to every BanEntry in this list. |
isBanned | Checks if a BanEntry exists for the target, indicating an active ban status. |
removeBan | Removes the specified IP address from this list, therefore indicating a “not banned” status. |
addBan
IpBanEntry &addBan(std::string address, std::optional<std::string> reason,
std::optional<BanEntry::Date> expires,
std::optional<std::string> source) overrideAdds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
addressThe IP address of the target.reasonThe reason for the ban, std::nullopt indicates implementation default.expiresThe date for the ban’s expiration (unban), or std::nullopt to imply forever.sourceThe source of the ban, std::nullopt indicates implementation default.
Returns:
IpBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.
IpBanEntry &addBan(std::string address, std::optional<std::string> reason,
std::chrono::seconds duration,
std::optional<std::string> source) overrideAdds a ban to this list. If a previous ban exists, this will update the previous entry.
Parameters:
addressThe IP address of the target.reasonThe reason for the ban, std::nullopt indicates implementation default.durationThe duration of the bansourceThe source of the ban, std::nullopt indicates implementation default.
Returns:
IpBanEntry& The entry for the newly created ban, or the entry for the (updated) previous ban.
getBanEntry
const IpBanEntry *getBanEntry(std::string address) override constGets a BanEntry by IP address.
Parameters:
addressThe IP address to search for.
Returns:
IpBanEntry* The corresponding entry, or nullptr if none found.
IpBanEntry *getBanEntry(std::string address) overrideGets a BanEntry by IP address.
Parameters:
addressThe IP address to search for.
Returns:
IpBanEntry* The corresponding entry, or nullptr if none found.
getEntries
std::vector<const IpBanEntry *> getEntries() override constGets a vector containing pointers to every BanEntry in this list.
Returns:
A vector containing pointers to every entry tracked by this list.
std::vector<IpBanEntry *> getEntries() overrideGets a vector containing pointers to every BanEntry in this list.
Returns:
A vector containing pointers to every entry tracked by this list.
isBanned
bool isBanned(std::string address) override constChecks if a BanEntry exists for the target, indicating an active ban status.
Parameters:
addressThe IP address to find.
Returns:
true If a BanEntry exists for the target, indicating an active ban status.
Returns:
false Otherwise.
removeBan
void removeBan(std::string address) overrideRemoves the specified IP address from this list, therefore indicating a “not banned” status.
Parameters:
addressThe IP address to remove from this list.