2025-06-15 04:55:14 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <vector>
|
2025-06-17 04:21:29 +08:00
|
|
|
|
#include <common/commands.h>
|
2025-06-15 04:55:14 +08:00
|
|
|
|
|
|
|
|
|
|
std::string GetIPAddress(const char* hostName);
|
|
|
|
|
|
|
2025-10-15 04:32:59 +08:00
|
|
|
|
class DomainPool
|
|
|
|
|
|
{
|
2025-06-15 04:55:14 +08:00
|
|
|
|
private:
|
2025-10-15 04:32:59 +08:00
|
|
|
|
char Address[100]; // <20>˳<EFBFBD><CBB3>Ⱥ<EFBFBD>CONNECT_ADDRESS<53><53><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
|
|
|
|
|
std::vector<std::string> IPList;
|
2025-06-15 04:55:14 +08:00
|
|
|
|
public:
|
2025-10-15 04:32:59 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
2025-06-15 04:55:14 +08:00
|
|
|
|
};
|