Browse Source

Minor JSON field name fixes and additions (#865)

* Change JSON supernodes field to match the struct member name

* Add some missing fields to the edge json output.
pull/864/head
Hamish Coleman 3 years ago
committed by GitHub
parent
commit
7b7449c813
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/edge_management.c

8
src/edge_management.c

@ -126,7 +126,7 @@ static void mgmt_supernodes (n2n_edge_t *eee, char *udp_buf, const struct sockad
"\"macaddr\":\"%s\"," "\"macaddr\":\"%s\","
"\"sockaddr\":\"%s\"," "\"sockaddr\":\"%s\","
"\"selection\":\"%s\"," "\"selection\":\"%s\","
"\"lastseen\":%li," "\"last_seen\":%li,"
"\"uptime\":%li}\n", "\"uptime\":%li}\n",
tag, tag,
peer->version, peer->version,
@ -156,17 +156,23 @@ static void mgmt_edges_row (n2n_edge_t *eee, char *udp_buf, const struct sockadd
"\"mode\":\"%s\"," "\"mode\":\"%s\","
"\"ip4addr\":\"%s\"," "\"ip4addr\":\"%s\","
"\"purgeable\":%i," "\"purgeable\":%i,"
"\"local\":%i,"
"\"macaddr\":\"%s\"," "\"macaddr\":\"%s\","
"\"sockaddr\":\"%s\"," "\"sockaddr\":\"%s\","
"\"desc\":\"%s\"," "\"desc\":\"%s\","
"\"last_p2p\":%li,\n"
"\"last_sent_query\":%li,\n"
"\"last_seen\":%li}\n", "\"last_seen\":%li}\n",
tag, tag,
mode, mode,
(peer->dev_addr.net_addr == 0) ? "" : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), (peer->dev_addr.net_addr == 0) ? "" : ip_subnet_to_str(ip_bit_str, &peer->dev_addr),
peer->purgeable, peer->purgeable,
peer->local,
(is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr),
sock_to_cstr(sockbuf, &(peer->sock)), sock_to_cstr(sockbuf, &(peer->sock)),
peer->dev_desc, peer->dev_desc,
peer->last_p2p,
peer->last_sent_query,
peer->last_seen); peer->last_seen);
sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0 /*flags*/, sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0 /*flags*/,

Loading…
Cancel
Save