mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 22:12:21 +00:00
26 lines
425 B
C++
26 lines
425 B
C++
#include <Poco/Net/DNS.h>
|
|
#include <base/getFQDNOrHostName.h>
|
|
|
|
|
|
namespace
|
|
{
|
|
std::string getFQDNOrHostNameImpl()
|
|
{
|
|
try
|
|
{
|
|
return Poco::Net::DNS::thisHost().name();
|
|
}
|
|
catch (...)
|
|
{
|
|
return Poco::Net::DNS::hostName();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
const std::string & getFQDNOrHostName()
|
|
{
|
|
static std::string result = getFQDNOrHostNameImpl();
|
|
return result;
|
|
}
|