TsgcWebSocketFirewallMethods › IsBanned

IsBanned Method

Returns True when the given IP address is currently banned, taking into account both manual and automatic bans and their remaining duration.

Syntax

function IsBanned(const aIP: string): Boolean;

Parameters

NameTypeDescription
aIPconst stringIPv4 or IPv6 address to check against the ban list.

Return Value

True if the IP is currently banned; False otherwise. Expired timed bans are treated as not banned and evicted lazily on the next check. (Boolean)

Remarks

IsBanned is cheap and thread-safe, so it can be called from custom event handlers to short-circuit application logic before further processing. It does not consult the Blacklist or GeoIP lists; those are evaluated by IsConnectionAllowed. Use IsBanned specifically to answer "is this IP currently under an active ban?".

Example

if sgcWebSocketFirewall1.IsBanned(Connection.IP) then
  Log('rejected banned IP: ' + Connection.IP);

Back to Methods