refactor: reorganize includes in DomainDiscovery.cpp and ModelCache.cpp for clarity
This commit is contained in:
@@ -1,29 +1,26 @@
|
||||
#include "DomainDiscovery.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <optional>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
// Minimal libcurl-based GET
|
||||
#include <curl/curl.h>
|
||||
|
||||
// For TCP probe
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace {
|
||||
|
||||
struct Buffer { std::string data; };
|
||||
|
||||
|
||||
size_t write_cb(char* ptr, size_t size, size_t nmemb, void* userdata) {
|
||||
auto* b = reinterpret_cast<Buffer*>(userdata);
|
||||
b->data.append(ptr, size * nmemb);
|
||||
@@ -58,7 +55,7 @@ std::optional<std::string> httpGet(const std::string& url, long timeoutMs = 3000
|
||||
|
||||
// Very small JSON helpers (avoid adding a full JSON lib):
|
||||
// Extract values for keys we care about with a permissive search.
|
||||
static std::vector<std::string> findAllStrings(const std::string& json, const std::string& key) {
|
||||
std::vector<std::string> findAllStrings(const std::string& json, const std::string& key) {
|
||||
std::vector<std::string> out;
|
||||
std::string needle = '"' + key + '"';
|
||||
size_t pos = 0;
|
||||
@@ -75,7 +72,7 @@ static std::vector<std::string> findAllStrings(const std::string& json, const st
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::vector<int> findAllInts(const std::string& json, const std::string& key) {
|
||||
std::vector<int> findAllInts(const std::string& json, const std::string& key) {
|
||||
std::vector<int> out;
|
||||
std::string needle = '"' + key + '"';
|
||||
size_t pos = 0;
|
||||
@@ -90,6 +87,8 @@ static std::vector<int> findAllInts(const std::string& json, const std::string&
|
||||
return out;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// Heuristic: map fields from common metaverse JSONs
|
||||
// Vircadia/Overte often expose entries with fields like name, network_address, domain, ice_server_address, port, etc.
|
||||
std::vector<DiscoveredDomain> parseDomains(const std::string& json) {
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
// ModelCache.cpp
|
||||
#include "ModelCache.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
// For HTTP downloads - using libcurl (cross-platform)
|
||||
#include <curl/curl.h>
|
||||
|
||||
// For hashing URLs to filenames
|
||||
#include <openssl/sha.h>
|
||||
|
||||
namespace {
|
||||
|
||||
Reference in New Issue
Block a user