mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
26 lines
427 B
C++
26 lines
427 B
C++
#include <Poco/Net/DNS.h>
|
|
#include <Common/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;
|
|
}
|