* Disabled NAT translation support for a little while.

0.6.6-post-fixes
Adam Frisby 2009-05-25 01:12:28 +00:00
parent 4e64bf9360
commit 9023b93e2f
1 changed files with 24 additions and 8 deletions

View File

@ -21,11 +21,22 @@ namespace OpenSim.Framework
// Logger
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static bool m_disabled = true;
public static bool Enabled
{
set { m_disabled = value; }
get { return m_disabled; }
}
// IPv4Address, Subnet
static readonly Dictionary<IPAddress,IPAddress> m_subnets = new Dictionary<IPAddress, IPAddress>();
public static IPAddress GetIPFor(IPAddress user, IPAddress simulator)
{
if(m_disabled)
return simulator;
// Check if we're accessing localhost.
foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
{
@ -167,11 +178,14 @@ namespace OpenSim.Framework
}
public static IPAddress GetIPFor(IPEndPoint user, string defaultHostname)
{
if (!m_disabled)
{
// Try subnet matching
IPAddress rtn = GetExternalIPFor(user.Address, defaultHostname);
if (rtn != null)
return rtn;
}
// Otherwise use the old algorithm
IPAddress ia;
@ -194,11 +208,13 @@ namespace OpenSim.Framework
}
public static string GetHostFor(IPAddress user, string defaultHostname)
{
if (!m_disabled)
{
IPAddress rtn = GetExternalIPFor(user, defaultHostname);
if (rtn != null)
return rtn.ToString();
}
return defaultHostname;
}
}