MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetInternal

Method SetInternal

src/netaddress.cpp:173–183  ·  view source on GitHub ↗

* Create an "internal" address that represents a name or FQDN. AddrMan uses * these fake addresses to keep track of which DNS seeds were used. * @returns Whether or not the operation was successful. * @see NET_INTERNAL, INTERNAL_IN_IPV6_PREFIX, CNetAddr::IsInternal(), CNetAddr::IsRFC4193() */

Source from the content-addressed store, hash-verified

171 * @see NET_INTERNAL, INTERNAL_IN_IPV6_PREFIX, CNetAddr::IsInternal(), CNetAddr::IsRFC4193()
172 */
173bool CNetAddr::SetInternal(const std::string &name)
174{
175 if (name.empty()) {
176 return false;
177 }
178 m_net = NET_INTERNAL;
179 unsigned char hash[32] = {};
180 CSHA256().Write((const unsigned char*)name.data(), name.size()).Finalize(hash);
181 m_addr.assign(hash, hash + ADDR_INTERNAL_SIZE);
182 return true;
183}
184
185namespace torv3 {
186// https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt#n2135

Callers 6

ThreadDNSAddressSeedMethod · 0.80
ThreadOpenConnectionsMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
MultiAddTimeDataFunction · 0.80
CreateInternalFunction · 0.80
ConsumeNetAddrFunction · 0.80

Calls 7

CSHA256Class · 0.85
emptyMethod · 0.45
FinalizeMethod · 0.45
WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45

Tested by 4

BOOST_AUTO_TEST_CASEFunction · 0.64
MultiAddTimeDataFunction · 0.64
CreateInternalFunction · 0.64
ConsumeNetAddrFunction · 0.64