Purpose of this Component
Is someone doing something malicious to your server? Keep them out!
The IpBlackList component let's you configured IP addresses to block.
It should be placed as close to the IoServer as possible as it will kick bad connections immediately.
Events triggered by this Component
- onOpen (ConnectionInterface $conn) - A new client connection has been opened
- onClose (ConnectionInterface $conn) - A client connection is about to, or has closed
- onMessage (ConnectionInterface $from, string $message) - A data message has been received
- onError (ConnectionInterface $from, Exception $error) - An error has occurred with a Connection
- IpBlackList blockAddress (string $address) - Specify an address to be blocked. This can be an IP4, IP6, or named address
- IpBlackList unblockAddress (string $address) - Unblock an address that was previously blocked
- boolean isBlocked (string $address) - Check to see if an address is being blocked
- array getBlockedAddresses () - Return an indexed array of all the addresses being blocked
Functions callable on Connections
- send (string $message) - Send a message (string) to the client
- close - Gracefully close the connection to the client
Parameters added to each Connection
Wrapped by other components nicely
// Your shell script
$blackList = new IpBlackList(new MyChat);
$blackList->blockAddress('188.8.131.52'); // Stop Google from connecting to our server
$server = IoServer::factory($blackList, 8080);