| 1182 | } |
| 1183 | |
| 1184 | UniValue AddrmanEntryToJSON(const AddrInfo& info, const CConnman& connman) |
| 1185 | { |
| 1186 | UniValue ret(UniValue::VOBJ); |
| 1187 | ret.pushKV("address", info.ToStringAddr()); |
| 1188 | const uint32_t mapped_as{connman.GetMappedAS(info)}; |
| 1189 | if (mapped_as) { |
| 1190 | ret.pushKV("mapped_as", mapped_as); |
| 1191 | } |
| 1192 | ret.pushKV("port", info.GetPort()); |
| 1193 | ret.pushKV("services", static_cast<std::underlying_type_t<decltype(info.nServices)>>(info.nServices)); |
| 1194 | ret.pushKV("time", TicksSinceEpoch<std::chrono::seconds>(info.nTime)); |
| 1195 | ret.pushKV("network", GetNetworkName(info.GetNetClass())); |
| 1196 | ret.pushKV("source", info.source.ToStringAddr()); |
| 1197 | ret.pushKV("source_network", GetNetworkName(info.source.GetNetClass())); |
| 1198 | const uint32_t source_mapped_as{connman.GetMappedAS(info.source)}; |
| 1199 | if (source_mapped_as) { |
| 1200 | ret.pushKV("source_mapped_as", source_mapped_as); |
| 1201 | } |
| 1202 | return ret; |
| 1203 | } |
| 1204 | |
| 1205 | UniValue AddrmanTableToJSON(const std::vector<std::pair<AddrInfo, AddressPosition>>& tableInfos, const CConnman& connman) |
| 1206 | { |
no test coverage detected