2015-02-10 13:22:13 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/types.h>
|
2018-03-29 20:21:01 +00:00
|
|
|
#include <Poco/Net/IPAddress.h>
|
|
|
|
|
2015-02-10 13:22:13 +00:00
|
|
|
|
2016-03-29 17:51:07 +00:00
|
|
|
namespace Poco
|
2015-02-10 13:22:13 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
namespace Net
|
|
|
|
{
|
|
|
|
class SocketAddress;
|
|
|
|
}
|
2015-02-10 13:22:13 +00:00
|
|
|
}
|
|
|
|
|
2016-03-29 17:51:07 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2017-05-07 20:25:26 +00:00
|
|
|
/** Lets you check if the address is similar to `localhost`.
|
|
|
|
* The purpose of this check is usually to make an assumption,
|
|
|
|
* that when we go to this address via the Internet, we'll get to ourselves.
|
|
|
|
* Please note that this check is not accurate:
|
|
|
|
* - the address is simply compared to the addresses of the network interfaces;
|
|
|
|
* - only the first address is taken for each network interface;
|
|
|
|
* - the routing rules that affect which network interface we go to the specified address are not checked.
|
2017-04-01 07:20:54 +00:00
|
|
|
*/
|
2018-11-26 00:56:50 +00:00
|
|
|
bool isLocalAddress(const Poco::Net::SocketAddress & address, UInt16 clickhouse_port);
|
2017-10-13 19:13:41 +00:00
|
|
|
bool isLocalAddress(const Poco::Net::SocketAddress & address);
|
2018-03-29 20:21:01 +00:00
|
|
|
bool isLocalAddress(const Poco::Net::IPAddress & address);
|
|
|
|
|
2017-11-14 13:13:24 +00:00
|
|
|
/// Returns number of different bytes in hostnames, used for load balancing
|
|
|
|
size_t getHostNameDifference(const std::string & local_hostname, const std::string & host);
|
2015-02-10 13:22:13 +00:00
|
|
|
}
|