use std::set

pull/564/head
Jeff Becker 5 years ago
parent 09f706b9cd
commit f7dc67b189
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -6,17 +6,14 @@ namespace llarp
{
namespace service
{
const std::vector< std::string > Address::AllowedTLDs = {".loki", ".snode"};
const std::set< std::string > Address::AllowedTLDs = {".loki", ".snode"};
bool
Address::PermitTLD(const char* tld)
{
std::string gtld(tld);
std::transform(gtld.begin(), gtld.end(), gtld.begin(), ::tolower);
for(const auto& allowed : AllowedTLDs)
if(allowed == tld)
return true;
return false;
return AllowedTLDs.count(gtld) != 0;
}
std::string

@ -8,6 +8,7 @@
#include <functional>
#include <numeric>
#include <string>
#include <set>
namespace llarp
{
@ -21,7 +22,7 @@ namespace llarp
std::string subdomain;
/// list of whitelisted gtld to permit
static const std::vector< std::string > AllowedTLDs;
static const std::set< std::string > AllowedTLDs;
/// return true if we permit using this tld
/// otherwise return false

Loading…
Cancel
Save