Skip to content

Class endstone::IpBanList

ClassList > endstone > IpBanList

Represents a ban list, containing banned IP addresses.

  • #include <endstone/ban/ip_ban_list.h>

Inherits the following classes: endstone::BanList

Public Types inherited from endstone::BanList

See endstone::BanList

Type Name
typedef T EntryType

Public Functions

Type Name
virtual NotNull< IpBanEntry > addBan (std::string address, std::optional< std::string > reason, std::optional< BanEntry::Date > expires, std::optional< std::string > source) override = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual NotNull< IpBanEntry > addBan (std::string address, std::optional< std::string > reason, std::chrono::seconds duration, std::optional< std::string > source) override = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual Nullable< IpBanEntry > getBanEntry (std::string address) override const = 0
Gets a BanEntry by IP address.
virtual std::vector< NotNull< IpBanEntry > > getEntries () override const = 0
Gets a vector containing pointers to every BanEntry in this list.
virtual bool isBanned (std::string address) override const = 0
Checks if a BanEntry exists for the target, indicating an active ban status.
virtual void removeBan (std::string address) override = 0
Removes the specified IP address from this list, therefore indicating a "not banned" status.

Public Functions inherited from endstone::BanList

See endstone::BanList

Type Name
virtual NotNull< T > addBan (std::string target, std::optional< std::string > reason, std::optional< BanEntry::Date > expires, std::optional< std::string > source) = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual NotNull< T > addBan (std::string target, std::optional< std::string > reason, std::chrono::seconds duration, std::optional< std::string > source) = 0
Adds a ban to this list. If a previous ban exists, this will update the previous entry.
virtual Nullable< T > getBanEntry (std::string target) const = 0
Gets a BanEntry by target.
virtual std::vector< NotNull< T > > getEntries () const = 0
Gets a vector containing pointers to every BanEntry in this list.
virtual bool isBanned (std::string target) const = 0
Checks if a BanEntry exists for the target, indicating an active ban status.
virtual void removeBan (std::string target) = 0
Removes the specified target from this list, therefore indicating a "not banned" status.
virtual ~BanList () = default

Public Functions Documentation

function addBan [½]

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

virtual NotNull < IpBanEntry > endstone::IpBanList::addBan (
    std::string address,
    std::optional< std::string > reason,
    std::optional< BanEntry::Date > expires,
    std::optional< std::string > source
) override = 0

Parameters:

  • address The IP address of the target.
  • reason The reason for the ban, std::nullopt indicates implementation default.
  • expires The date for the ban's expiration (unban), or std::nullopt to imply forever.
  • source The 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.

Implements endstone::BanList::addBan


function addBan [2/2]

Adds a ban to this list. If a previous ban exists, this will update the previous entry.

virtual NotNull < IpBanEntry > endstone::IpBanList::addBan (
    std::string address,
    std::optional< std::string > reason,
    std::chrono::seconds duration,
    std::optional< std::string > source
) override = 0

Parameters:

  • address The IP address of the target.
  • reason The reason for the ban, std::nullopt indicates implementation default.
  • duration The duration of the ban
  • source The 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.

Implements endstone::BanList::addBan


function getBanEntry

Gets a BanEntry by IP address.

virtual Nullable < IpBanEntry > endstone::IpBanList::getBanEntry (
    std::string address
) override const = 0

Parameters:

  • address The IP address to search for.

Returns:

IpBanEntry The corresponding entry, or nullptr if none found.

Implements endstone::BanList::getBanEntry


function getEntries

Gets a vector containing pointers to every BanEntry in this list.

virtual std::vector< NotNull < IpBanEntry > > endstone::IpBanList::getEntries () override const = 0

Returns:

A vector containing pointers to every entry tracked by this list.

Implements endstone::BanList::getEntries


function isBanned

Checks if a BanEntry exists for the target, indicating an active ban status.

virtual bool endstone::IpBanList::isBanned (
    std::string address
) override const = 0

Parameters:

  • address The IP address to find.

Returns:

true If a BanEntry exists for the target, indicating an active ban status.

Returns:

false Otherwise.

Implements endstone::BanList::isBanned


function removeBan

Removes the specified IP address from this list, therefore indicating a "not banned" status.

virtual void endstone::IpBanList::removeBan (
    std::string address
) override = 0

Parameters:

  • address The IP address to remove from this list.

Implements endstone::BanList::removeBan



The documentation for this class was generated from the following file include/endstone/ban/ip_ban_list.h