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