Files
SimpleRemoter/client/domain_pool.h
2025-10-19 09:04:27 +02:00

36 lines
784 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <string>
#include <vector>
#include <common/commands.h>
std::string GetIPAddress(const char* hostName);
class DomainPool
{
private:
char Address[100]; // ´Ë³¤¶ÈºÍCONNECT_ADDRESS¶¨Ò寥Åä
std::vector<std::string> IPList;
public:
DomainPool()
{
memset(Address, 0, sizeof(Address));
}
DomainPool(const char* addr)
{
strcpy_s(Address, addr ? addr : "");
IPList = StringToVector(Address, ';');
for (int i = 0; i < IPList.size(); i++) {
IPList[i] = GetIPAddress(IPList[i].c_str());
}
}
std::string SelectIP() const
{
auto n = rand() % IPList.size();
return IPList[n];
}
std::vector<std::string> GetIPList() const
{
return IPList;
}
};