mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-05 23:36:09 +00:00
reformat
This commit is contained in:
@@ -12,31 +12,32 @@
|
||||
#include <winsock2.h>
|
||||
#elif defined(__linux__)
|
||||
#include "linuxfixes.h"
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
std::string GetAddr(const std::string&IP){
|
||||
if(IP.find_first_not_of("0123456789.") == -1)return IP;
|
||||
hostent *host;
|
||||
#ifdef _WIN32
|
||||
std::string GetAddr(const std::string& IP) {
|
||||
if (IP.find_first_not_of("0123456789.") == -1)
|
||||
return IP;
|
||||
hostent* host;
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
if(WSAStartup(514, &wsaData) != 0){
|
||||
if (WSAStartup(514, &wsaData) != 0) {
|
||||
error("WSA Startup Failed!");
|
||||
WSACleanup();
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
host = gethostbyname(IP.c_str());
|
||||
if(!host){
|
||||
if (!host) {
|
||||
error("DNS lookup failed! on " + IP);
|
||||
WSACleanup();
|
||||
return "DNS";
|
||||
}
|
||||
std::string Ret = inet_ntoa(*((struct in_addr *)host->h_addr));
|
||||
std::string Ret = inet_ntoa(*((struct in_addr*)host->h_addr));
|
||||
WSACleanup();
|
||||
return Ret;
|
||||
}
|
||||
Reference in New Issue
Block a user