Whitelist now accepts hostnames as well.
This commit is contained in:
parent
5e7130aa88
commit
a030a8ba0f
1 changed files with 13 additions and 1 deletions
|
|
@ -103,7 +103,19 @@ namespace TShockAPI
|
|||
TextReader tr = new StreamReader(WhitelistPath);
|
||||
string whitelist = tr.ReadToEnd();
|
||||
ip = Tools.GetRealIP(ip);
|
||||
return whitelist.Contains(ip);
|
||||
bool contains = whitelist.Contains(ip);
|
||||
if (!contains)
|
||||
{
|
||||
foreach (var line in whitelist.Split(Environment.NewLine.ToCharArray()))
|
||||
{
|
||||
contains = Tools.GetIPv4Address(line).Equals(ip);
|
||||
if (contains)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue