MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_add_address_internal

Function json_add_address_internal

common/json_stream.c:497–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497void json_add_address_internal(struct json_stream *response,
498 const char *fieldname,
499 const struct wireaddr_internal *addr)
500{
501 switch (addr->itype) {
502 case ADDR_INTERNAL_SOCKNAME:
503 json_object_start(response, fieldname);
504 json_add_string(response, "type", "local socket");
505 json_add_string(response, "socket", addr->u.sockname);
506 json_object_end(response);
507 return;
508 case ADDR_INTERNAL_ALLPROTO:
509 json_object_start(response, fieldname);
510 json_add_string(response, "type", "any protocol");
511 json_add_num(response, "port", addr->u.port);
512 json_object_end(response);
513 return;
514 case ADDR_INTERNAL_AUTOTOR:
515 json_object_start(response, fieldname);
516 json_add_string(response, "type", "Tor generated address");
517 json_add_address(response, "service", &addr->u.torservice.address);
518 json_object_end(response);
519 return;
520 case ADDR_INTERNAL_STATICTOR:
521 json_object_start(response, fieldname);
522 json_add_string(response, "type", "Tor from blob generated static address");
523 json_add_address(response, "service", &addr->u.torservice.address);
524 json_object_end(response);
525 return;
526 case ADDR_INTERNAL_FORPROXY:
527 json_object_start(response, fieldname);
528 json_add_string(response, "type", "unresolved");
529 json_add_string(response, "name", addr->u.unresolved.name);
530 json_add_num(response, "port", addr->u.unresolved.port);
531 json_object_end(response);
532 return;
533 case ADDR_INTERNAL_WIREADDR:
534 json_add_address(response, fieldname, &addr->u.wireaddr);
535 return;
536 }
537 abort();
538}
539
540void json_add_tx(struct json_stream *result,
541 const char *fieldname,

Callers

nothing calls this directly

Calls 6

abortFunction · 0.85
json_object_startFunction · 0.70
json_add_stringFunction · 0.70
json_object_endFunction · 0.70
json_add_numFunction · 0.70
json_add_addressFunction · 0.70

Tested by

no test coverage detected