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

Function conn_proxy_init

connectd/connectd.c:1021–1051  ·  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

1019/* This initializes a fresh io_conn by setting it to io_connect to the
1020 * SOCKS proxy, as handled in tor.c. */
1021static struct io_plan *conn_proxy_init(struct io_conn *conn,
1022 struct connecting *connect)
1023{
1024 const char *host = NULL;
1025 u16 port;
1026 const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
1027
1028 switch (addr->itype) {
1029 case ADDR_INTERNAL_FORPROXY:
1030 host = addr->u.unresolved.name;
1031 port = addr->u.unresolved.port;
1032 break;
1033 case ADDR_INTERNAL_WIREADDR:
1034 host = fmt_wireaddr_without_port(tmpctx, &addr->u.wireaddr.wireaddr);
1035 port = addr->u.wireaddr.wireaddr.port;
1036 break;
1037 case ADDR_INTERNAL_SOCKNAME:
1038 case ADDR_INTERNAL_ALLPROTO:
1039 case ADDR_INTERNAL_AUTOTOR:
1040 case ADDR_INTERNAL_STATICTOR:
1041 break;
1042 }
1043
1044 if (!host)
1045 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1046 "Can't connect to %u address", addr->itype);
1047
1048 io_set_finish(conn, destroy_io_conn, connect);
1049 return io_tor_connect(conn, connect->daemon->proxyaddr, host, port,
1050 connect);
1051}
1052
1053/*~ This is the routine which tries to connect. */
1054static void try_connect_one_addr(struct connecting *connect)

Callers

nothing calls this directly

Calls 3

io_tor_connectFunction · 0.85
status_failedFunction · 0.50

Tested by

no test coverage detected