MCPcopy Create free account
hub / github.com/catboost/catboost / TEndpoint

Class TEndpoint

util/network/endpoint.h:8–46  ·  view source on GitHub ↗

some equivalent boost::asio::ip::endpoint (easy for using pair ip:port)

Source from the content-addressed store, hash-verified

6
7// some equivalent boost::asio::ip::endpoint (easy for using pair ip:port)
8class TEndpoint {
9public:
10 using TAddrRef = NAddr::IRemoteAddrRef;
11
12 TEndpoint(const TAddrRef& addr);
13 TEndpoint();
14
15 inline const TAddrRef& Addr() const noexcept {
16 return Addr_;
17 }
18 inline const sockaddr* SockAddr() const {
19 return Addr_->Addr();
20 }
21 inline socklen_t SockAddrLen() const {
22 return Addr_->Len();
23 }
24
25 inline bool IsIpV4() const {
26 return Addr_->Addr()->sa_family == AF_INET;
27 }
28 inline bool IsIpV6() const {
29 return Addr_->Addr()->sa_family == AF_INET6;
30 }
31 inline bool IsUnix() const {
32 return Addr_->Addr()->sa_family == AF_UNIX;
33 }
34
35 inline TString IpToString() const {
36 return NAddr::PrintHost(*Addr_);
37 }
38
39 void SetPort(ui16 port);
40 ui16 Port() const noexcept;
41
42 size_t Hash() const;
43
44private:
45 TAddrRef Addr_;
46};
47
48template <>
49struct THash<TEndpoint> {

Callers 2

ExecuteMethod · 0.85
Y_UNIT_TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected