| 2059 | class TUnixSocketResolver { |
| 2060 | public: |
| 2061 | NDns::TResolvedHost* Resolve(const TString& path) { |
| 2062 | TString unixSocketPath = path; |
| 2063 | if (path.size() > 2 && path[0] == '[' && path[path.size() - 1] == ']') { |
| 2064 | unixSocketPath = path.substr(1, path.size() - 2); |
| 2065 | } |
| 2066 | |
| 2067 | if (auto resolvedUnixSocket = ResolvedUnixSockets_.FindPtr(unixSocketPath)) { |
| 2068 | return resolvedUnixSocket->Get(); |
| 2069 | } |
| 2070 | |
| 2071 | TNetworkAddress na{TUnixSocketPath(unixSocketPath)}; |
| 2072 | ResolvedUnixSockets_[unixSocketPath] = MakeHolder<NDns::TResolvedHost>(unixSocketPath, na); |
| 2073 | |
| 2074 | return ResolvedUnixSockets_[unixSocketPath].Get(); |
| 2075 | } |
| 2076 | |
| 2077 | private: |
| 2078 | THashMap<TString, THolder<NDns::TResolvedHost>> ResolvedUnixSockets_; |