mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
Don't exit w/ INTERNAL_ERROR, if --addr or --bind-addr is used with an .onion address
The Fairy Tail version of .onion option calls on cmdline reroute the call to --announce-addr or just drop it in case of bind. Signed-off-by: Saibato <saibato.naga@pm.me>
This commit is contained in:
parent
d0ccd15ac0
commit
1b9cec8e91
@ -149,16 +149,6 @@ static char *opt_add_addr_withtype(const char *arg,
|
||||
|
||||
}
|
||||
|
||||
static char *opt_add_addr(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
return opt_add_addr_withtype(arg, ld, ADDR_LISTEN_AND_ANNOUNCE, true);
|
||||
}
|
||||
|
||||
static char *opt_add_bind_addr(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
return opt_add_addr_withtype(arg, ld, ADDR_LISTEN, true);
|
||||
}
|
||||
|
||||
static char *opt_add_announce_addr(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
const struct wireaddr *wn;
|
||||
@ -193,6 +183,46 @@ static char *opt_add_announce_addr(const char *arg, struct lightningd *ld)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *opt_add_addr(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
struct wireaddr_internal addr;
|
||||
|
||||
/* handle in case you used the addr option with an .onion */
|
||||
if (parse_wireaddr_internal(arg, &addr, 0, true, false, true, NULL)) {
|
||||
if (addr.itype == ADDR_INTERNAL_WIREADDR && (
|
||||
addr.u.wireaddr.type == ADDR_TYPE_TOR_V2 ||
|
||||
addr.u.wireaddr.type == ADDR_TYPE_TOR_V3)) {
|
||||
log_unusual(ld->log, "You used `--addr=%s` option with an .onion address, please use"
|
||||
" `--announce-addr` ! You are lucky in this node live some wizards and"
|
||||
" fairies, we have done this for you and announce, Be as hidden as wished",
|
||||
arg);
|
||||
return opt_add_announce_addr(arg, ld);
|
||||
}
|
||||
}
|
||||
/* the intended call */
|
||||
return opt_add_addr_withtype(arg, ld, ADDR_LISTEN_AND_ANNOUNCE, true);
|
||||
}
|
||||
|
||||
static char *opt_add_bind_addr(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
struct wireaddr_internal addr;
|
||||
|
||||
/* handle in case you used the bind option with an .onion */
|
||||
if (parse_wireaddr_internal(arg, &addr, 0, true, false, true, NULL)) {
|
||||
if (addr.itype == ADDR_INTERNAL_WIREADDR && (
|
||||
addr.u.wireaddr.type == ADDR_TYPE_TOR_V2 ||
|
||||
addr.u.wireaddr.type == ADDR_TYPE_TOR_V3)) {
|
||||
log_unusual(ld->log, "You used `--bind-addr=%s` option with an .onion address,"
|
||||
" You are lucky in this node live some wizards and"
|
||||
" fairies, we have done this for you and don't announce, Be as hidden as wished",
|
||||
arg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* the intended call */
|
||||
return opt_add_addr_withtype(arg, ld, ADDR_LISTEN, true);
|
||||
}
|
||||
|
||||
static void opt_show_u64(char buf[OPT_SHOW_LEN], const u64 *u)
|
||||
{
|
||||
snprintf(buf, OPT_SHOW_LEN, "%"PRIu64, *u);
|
||||
|
Loading…
Reference in New Issue
Block a user