std::string Common::getDestination(const RecordPtr& record, const std::string& source) { if (record->getName() == source) return record->getOnion(); NameList list = record->getSubdomains(); for (auto subdomain : list) if (subdomain.first + "." + record->getName() == source) return subdomain.second; Log::get().error("Record does not contain \"" + source + "\"!"); return ""; }
bool Cache::add(const RecordPtr& record) { // todo: delete Records should cause deletion/replacement, etc if (get(record->getName())) return false; // cannot add record, name is already taken records_.push_back(record); return true; }