BanningFiltering IPs

Version 1 (Alan McGovern, 10/24/2010 08:20 PM) → Version 2/5 (Alan McGovern, 10/24/2010 08:20 PM)


h1. BanningFiltering IPs



[code]
private void BanPeer (ClientEngine engine)
{
// Hook up a handler to the 'BanPeer' event. This is raised
// every time a connection is received or an outgoing connection
// is about to be created. If you wish to close/abort the connection
// just set "BanPeer" to true.
engine.ConnectionManager.BanPeer += delegate(object sender, AttemptConnectionEventArgs e) {
if (e.Peer.ConnectionUri.Host == "192.168.0.5")
e.BanPeer = true;
};
}
[/code]