common/tor: move into lightningd.

This is simply the code to set up the automatic hidden service, so move
it into lightningd.

I removed the undefined parse_tor_wireaddr, and added a parameter name
to the create_tor_hidden_service_conn() declaration for update-mocks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-05-10 08:48:23 +09:30
parent d9f13230cf
commit 85eff42d9a
8 changed files with 21 additions and 19 deletions

View File

@ -42,7 +42,6 @@ COMMON_SRC_NOGEN := \
common/timeout.c \
common/type_to_string.c \
common/utils.c \
common/tor.c \
common/utxo.c \
common/version.c \
common/wallet_tx.c \

View File

@ -1,13 +0,0 @@
#ifndef LIGHTNING_COMMON_TOR_H
#define LIGHTNING_COMMON_TOR_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <lightningd/lightningd.h>
#include <stdbool.h>
#include <stdlib.h>
bool check_return_from_service_call(void);
bool parse_tor_wireaddr(const char *arg,u8 *ip_ld,u16 *port_ld);
bool create_tor_hidden_service_conn(struct lightningd *);
#endif /* LIGHTNING_COMMON_TOR_H */

View File

@ -44,7 +44,6 @@ LIGHTNINGD_COMMON_OBJS := \
common/type_to_string.o \
common/utils.o \
common/utxo.o \
common/tor.o \
common/version.o \
common/wallet_tx.o \
common/wire_error.o \
@ -77,6 +76,7 @@ LIGHTNINGD_SRC := \
lightningd/peer_control.c \
lightningd/peer_htlcs.c \
lightningd/subd.c \
lightningd/tor.c \
lightningd/watch.c
# Source files without corresponding headers

View File

@ -21,7 +21,6 @@
#include <common/daemon.h>
#include <common/memleak.h>
#include <common/timeout.h>
#include <common/tor.h>
#include <common/utils.h>
#include <common/version.h>
#include <errno.h>
@ -33,6 +32,7 @@
#include <lightningd/log.h>
#include <lightningd/onchain_control.h>
#include <lightningd/options.h>
#include <lightningd/tor.h>
#include <onchaind/onchain_wire.h>
#include <signal.h>
#include <sys/types.h>

View File

@ -12,7 +12,6 @@
#include <common/configdir.h>
#include <common/json_escaped.h>
#include <common/memleak.h>
#include <common/tor.h>
#include <common/version.h>
#include <common/wireaddr.h>
#include <errno.h>

View File

@ -2,7 +2,6 @@
int unused_main(int argc, char *argv[]);
#include "../../common/base32.c"
#include "../../common/wireaddr.c"
#include "../../common/tor.c"
#include "../lightningd.c"
/* AUTOGENERATED MOCKS START */
@ -12,6 +11,12 @@ void activate_peers(struct lightningd *ld UNNEEDED)
/* Generated stub for begin_topology */
void begin_topology(struct chain_topology *topo UNNEEDED)
{ fprintf(stderr, "begin_topology called!\n"); abort(); }
/* Generated stub for check_return_from_service_call */
bool check_return_from_service_call(void)
{ fprintf(stderr, "check_return_from_service_call called!\n"); abort(); }
/* Generated stub for create_tor_hidden_service_conn */
bool create_tor_hidden_service_conn(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "create_tor_hidden_service_conn called!\n"); abort(); }
/* Generated stub for daemon_setup */
void daemon_setup(const char *argv0 UNNEEDED,
void (*backtrace_print)(const char *fmt UNNEEDED, ...) UNNEEDED,

View File

@ -4,12 +4,12 @@
#include <ccan/io/io.h>
#include <ccan/str/hex/hex.h>
#include <ccan/tal/str/str.h>
#include <common/tor.h>
#include <common/type_to_string.h>
#include <common/utils.h>
#include <common/wireaddr.h>
#include <errno.h>
#include <fcntl.h>
#include <lightningd/tor.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>

12
lightningd/tor.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef LIGHTNING_LIGHTNINGD_TOR_H
#define LIGHTNING_LIGHTNINGD_TOR_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <lightningd/lightningd.h>
#include <stdbool.h>
#include <stdlib.h>
bool check_return_from_service_call(void);
bool create_tor_hidden_service_conn(struct lightningd *ld);
#endif /* LIGHTNING_LIGHTNINGD_TOR_H */