| 1219 | } |
| 1220 | |
| 1221 | static RPCMethod getrawaddrman() |
| 1222 | { |
| 1223 | return RPCMethod{"getrawaddrman", |
| 1224 | "EXPERIMENTAL warning: this call may be changed in future releases.\n" |
| 1225 | "\nReturns information on all address manager entries for the new and tried tables.\n", |
| 1226 | {}, |
| 1227 | RPCResult{ |
| 1228 | RPCResult::Type::OBJ_DYN, "", "", { |
| 1229 | {RPCResult::Type::OBJ_DYN, "table", "buckets with addresses in the address manager table ( new, tried )", { |
| 1230 | {RPCResult::Type::OBJ, "bucket/position", "the location in the address manager table (<bucket>/<position>)", { |
| 1231 | {RPCResult::Type::STR, "address", "The address of the node"}, |
| 1232 | {RPCResult::Type::NUM, "mapped_as", /*optional=*/true, "Mapped AS (Autonomous System) number at the end of the BGP route to the peer, used for diversifying peer selection (only displayed if the -asmap config option is set)"}, |
| 1233 | {RPCResult::Type::NUM, "port", "The port number of the node"}, |
| 1234 | {RPCResult::Type::STR, "network", "The network (" + Join(GetNetworkNames(), ", ") + ") of the address"}, |
| 1235 | {RPCResult::Type::NUM, "services", "The services offered by the node"}, |
| 1236 | {RPCResult::Type::NUM_TIME, "time", "The " + UNIX_EPOCH_TIME + " when the node was last seen"}, |
| 1237 | {RPCResult::Type::STR, "source", "The address that relayed the address to us"}, |
| 1238 | {RPCResult::Type::STR, "source_network", "The network (" + Join(GetNetworkNames(), ", ") + ") of the source address"}, |
| 1239 | {RPCResult::Type::NUM, "source_mapped_as", /*optional=*/true, "Mapped AS (Autonomous System) number at the end of the BGP route to the source, used for diversifying peer selection (only displayed if the -asmap config option is set)"} |
| 1240 | }} |
| 1241 | }} |
| 1242 | } |
| 1243 | }, |
| 1244 | RPCExamples{ |
| 1245 | HelpExampleCli("getrawaddrman", "") |
| 1246 | + HelpExampleRpc("getrawaddrman", "") |
| 1247 | }, |
| 1248 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { |
| 1249 | AddrMan& addrman = EnsureAnyAddrman(request.context); |
| 1250 | NodeContext& node_context = EnsureAnyNodeContext(request.context); |
| 1251 | CConnman& connman = EnsureConnman(node_context); |
| 1252 | |
| 1253 | UniValue ret(UniValue::VOBJ); |
| 1254 | ret.pushKV("new", AddrmanTableToJSON(addrman.GetEntries(false), connman)); |
| 1255 | ret.pushKV("tried", AddrmanTableToJSON(addrman.GetEntries(true), connman)); |
| 1256 | return ret; |
| 1257 | }, |
| 1258 | }; |
| 1259 | } |
| 1260 | |
| 1261 | void RegisterNetRPCCommands(CRPCTable& t) |
| 1262 | { |
nothing calls this directly
no test coverage detected