If you want top security measures on your server then implement a different banning system in the authserver--ban by their IP obtained from sockets, you won't be coming back if you do it that way. WowwoW had this feature if I can remember.
EDIT: Dug it up.
Code:
using System;
using System.Collections.Generic;
using WowwoW.Core;
/*************************
* IP config system
* Uses:
* Temporary IP bans
* Different ip checking
*
* About ip checking:
* We know 2 user's ips:
* -from socket
* -from packet
* Usually they are similar.
*
* Different values can mean:
* 1. User uses proxy server
* 2. User changes ip info in packet (cheating)
*
* You can allow specific users to use proxy.
*
* If proxy is not allowed, user with different
* ips will be disconnected
*
************************/
namespace WowwoW.AuthServer
{
/// <summary>
/// Info about some ips
/// </summary>
class IpInfo
{
public bool banned;
public bool ip_cheat;
}
/// <summary>
/// Small helper
/// </summary>
struct RowIpInfo
{
public bool proxy_allowed;
public bool banned;
public RowIpInfo(bool prox, bool ban)
{
proxy_allowed = prox;
banned = ban;
}
}
/// <summary>
/// Handler of ip_config table
/// </summary>
class IpTable
{
/// <summary>
/// Contains all info about ips
/// </summary>
static Dictionary<String, RowIpInfo> Ips = new Dictionary<String, RowIpInfo>();
/// <summary>
/// get info about ip from list
/// </summary>
/// <remarks>Proxy settings are used very rarely</remarks>
/// <param name="sock_ip">IP address fro Socket</param>
/// <param name="recv_ip">IP address fro Packet</param>
/// <returns></returns>
static public IpInfo GetIpInfo(string sock_ip, string recv_ip)
{
lock (Ips)
{
IpInfo res = new IpInfo();
//-- If ips are different
if (sock_ip != recv_ip)
{
//-- Both ips are existing
if (Ips.ContainsKey(sock_ip) && Ips.ContainsKey(recv_ip))
{
RowIpInfo a = Ips[recv_ip];
RowIpInfo b = Ips[sock_ip];
res.banned = (a.banned || b.banned);
res.ip_cheat = (!a.proxy_allowed && !b.proxy_allowed); //only one must have info
return res;
}
//-- Packet ip is existing
if (!Ips.ContainsKey(sock_ip) && Ips.ContainsKey(recv_ip))
{
RowIpInfo a = Ips[recv_ip];
res.banned = a.banned;
res.ip_cheat = !a.proxy_allowed;
return res;
}
//-- Sock ip is existing
if (Ips.ContainsKey(sock_ip) && !Ips.ContainsKey(recv_ip))
{
RowIpInfo a = Ips[sock_ip];
res.banned = a.banned;
res.ip_cheat = !a.proxy_allowed;
return res;
}
}
//-- Ip1 = ip2. Check ban
res.ip_cheat = false;
res.banned = (Ips.ContainsKey(sock_ip) && Ips[sock_ip].banned);
return res;
}
}
/// <summary>
/// Reload list of ips
/// </summary>
static public void Reload()
{
lock (Ips)
{
//-- Clear all bans before do this
AuthServer.DB.ExecuteNonQuery("DELETE FROM `IPConfig` WHERE `UnBan`<= ?",WowwoW.Tools.CustomDateTime.Now);
//-- Clear current list
Ips.Clear();
//-- Load new info
using (DbReader myReader = AuthServer.DB.Query("SELECT * FROM `IPConfig`"))
{
while (myReader.HasRows)
{
myReader.Read();
Ips.Add(myReader.GetString("Ip"), new RowIpInfo(myReader.GetBoolean("ProxyLogin"), myReader.GetBoolean("Banned")));
}
}
}
}
}
}
It stores the IPs in a dictionary and compares them.