MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / IsSameSubnet

Method IsSameSubnet

libi2pd/RouterInfo.cpp:1203–1216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201 }
1202
1203 bool RouterInfo::IsSameSubnet (const RouterInfo& other) const
1204 {
1205 auto transports = m_SupportedTransports & other.m_SupportedTransports;
1206 if (!transports) return false;
1207 auto addresses1 = GetAddresses (), addresses2 = other.GetAddresses ();;
1208 for (int i = 0; i < eNumTransports; i++)
1209 if (i != eNTCP2V6MeshIdx && (transports & (1 << i)))
1210 {
1211 auto addr1 = (*addresses1)[i], addr2 = (*addresses2)[i];
1212 if (addr1 && addr2 && !addr1->host.is_unspecified () && !addr2->host.is_unspecified ())
1213 return addr1->IsSameSubnet (*addr2); // first adddess with IPs
1214 }
1215 return false;
1216 }
1217
1218 void LocalRouterInfo::CreateBuffer (const PrivateKeys& privateKeys)
1219 {

Callers 2

GetRandomRouterMethod · 0.45

Calls 1

GetAddressesMethod · 0.80

Tested by

no test coverage detected