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

Function conn_proxy_init

connectd/connectd.c:1077–1107  ·  view source on GitHub ↗

This initializes a fresh io_conn by setting it to io_connect to the * SOCKS proxy, as handled in tor.c. */

Source from the content-addressed store, hash-verified

1075/* This initializes a fresh io_conn by setting it to io_connect to the
1076 * SOCKS proxy, as handled in tor.c. */
1077static struct io_plan *conn_proxy_init(struct io_conn *conn,
1078 struct connecting *connect)
1079{
1080 const char *host = NULL;
1081 u16 port;
1082 const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
1083
1084 switch (addr->itype) {
1085 case ADDR_INTERNAL_FORPROXY:
1086 host = addr->u.unresolved.name;
1087 port = addr->u.unresolved.port;
1088 break;
1089 case ADDR_INTERNAL_WIREADDR:
1090 host = fmt_wireaddr_without_port(tmpctx, &addr->u.wireaddr.wireaddr);
1091 port = addr->u.wireaddr.wireaddr.port;
1092 break;
1093 case ADDR_INTERNAL_SOCKNAME:
1094 case ADDR_INTERNAL_ALLPROTO:
1095 case ADDR_INTERNAL_AUTOTOR:
1096 case ADDR_INTERNAL_STATICTOR:
1097 break;
1098 }
1099
1100 if (!host)
1101 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1102 "Can't connect to %u address", addr->itype);
1103
1104 io_set_finish(conn, destroy_io_conn, connect);
1105 return io_tor_connect(conn, connect->daemon->proxyaddr, host, port,
1106 connect);
1107}
1108
1109/*~ Resolving a DNS address used to be a synchronous getaddrinfo() right
1110 * here: a slow or unresponsive nameserver would then hold up every peer

Callers

nothing calls this directly

Calls 3

io_tor_connectFunction · 0.85
status_failedFunction · 0.50

Tested by

no test coverage detected