BanningFiltering IPs

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

1 1
h1. BanningFiltering IPs
2 1
3 1
[code]
4 1
private void BanPeer (ClientEngine engine)
5 1
{
6 1
    // Hook up a handler to the 'BanPeer' event. This is raised
7 1
    // every time a connection is received or an outgoing connection
8 1
    // is about to be created. If you wish to close/abort the connection
9 1
    // just set "BanPeer" to true.
10 1
    engine.ConnectionManager.BanPeer += delegate(object sender, AttemptConnectionEventArgs e) {
11 1
        if (e.Peer.ConnectionUri.Host == "192.168.0.5")
12 1
            e.BanPeer = true;
13 1
    };
14 1
}
15 1
[/code]