mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
Init commit to be able to create a tor static service on the fly.
We want to have a static Tor service created from a blob bound to our node on cmdline Changelog-added: persistent Tor address support Changelog-added: allow the Tor inbound service port differ from 9735 Signed-off-by: Saibato <saibato.naga@pm.me> Add base64 encode/decode to common We need this to encode the blob for the tor service Signed-off-by: Saibato <saibato.naga@pm.me>
This commit is contained in:
committed by
Christian Decker
parent
99ff86f6fe
commit
f6006f43a9
@@ -17,6 +17,7 @@ LIGHTNINGD_COMMON_OBJS := \
|
||||
common/addr.o \
|
||||
common/amount.o \
|
||||
common/base32.o \
|
||||
common/base64.o \
|
||||
common/bech32.o \
|
||||
common/bech32_util.o \
|
||||
common/bigsize.o \
|
||||
|
||||
@@ -249,7 +249,13 @@ void json_add_address_internal(struct json_stream *response,
|
||||
case ADDR_INTERNAL_AUTOTOR:
|
||||
json_object_start(response, fieldname);
|
||||
json_add_string(response, "type", "Tor generated address");
|
||||
json_add_address(response, "service", &addr->u.torservice);
|
||||
json_add_address(response, "service", &addr->u.torservice.address);
|
||||
json_object_end(response);
|
||||
return;
|
||||
case ADDR_INTERNAL_STATICTOR:
|
||||
json_object_start(response, fieldname);
|
||||
json_add_string(response, "type", "Tor from blob generated static address");
|
||||
json_add_address(response, "service", &addr->u.torservice.address);
|
||||
json_object_end(response);
|
||||
return;
|
||||
case ADDR_INTERNAL_FORPROXY:
|
||||
|
||||
@@ -68,7 +68,7 @@ struct config {
|
||||
/* Minimal amount of effective funding_satoshis for accepting channels */
|
||||
u64 min_capacity_sat;
|
||||
|
||||
/* Allow to define the default behavior of tot services calls*/
|
||||
/* Allow to define the default behavior of tor services calls*/
|
||||
bool use_v3_autotor;
|
||||
|
||||
/* This is the key we use to encrypt `hsm_secret`. */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <ccan/tal/path/path.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/base64.h>
|
||||
#include <common/derive_basepoints.h>
|
||||
#include <common/features.h>
|
||||
#include <common/json_command.h>
|
||||
@@ -136,6 +137,10 @@ static char *opt_add_announce_addr(const char *arg, struct lightningd *ld)
|
||||
if (strstarts(arg, "autotor:"))
|
||||
return opt_add_addr(arg, ld);
|
||||
|
||||
/* Check for statictor and reroute the call to --addr */
|
||||
if (strstarts(arg, "statictor:"))
|
||||
return opt_add_addr(arg, ld);
|
||||
|
||||
err = opt_add_addr_withtype(arg, ld, ADDR_ANNOUNCE, false);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -603,6 +608,7 @@ static const struct config mainnet_config = {
|
||||
/* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */
|
||||
.min_capacity_sat = 10000,
|
||||
|
||||
/* Allow to define the default behavior of tor services calls*/
|
||||
.use_v3_autotor = true,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user