mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
cleanup: rename use_proxy_always to always_use_proxy to match cfg
This renames all occurences of use_proxy_always to always_use_proxy to keep it inline with config values. This was a bit confusing. Only significant change is that the payload in the plugins init requests also contained the old name. No plugin currently seems to make use of this variable yet. The old name 'use_proxy_always' is added when deprecated APIs is enabled. Changelog-Deprecated: Plugins: Renames plugin init 'use_proxy_always' to 'always_use_proxy'
This commit is contained in:
parent
0550ffa9db
commit
24ea498350
7 changed files with 19 additions and 16 deletions
|
@ -145,7 +145,7 @@ struct daemon {
|
|||
struct addrinfo *proxyaddr;
|
||||
|
||||
/* They can tell us we must use proxy even for non-Tor addresses. */
|
||||
bool use_proxy_always;
|
||||
bool always_use_proxy;
|
||||
|
||||
/* There are DNS seeds we can use to look up node addresses as a last
|
||||
* resort, but doing so leaks our address so can be disabled. */
|
||||
|
@ -216,7 +216,7 @@ static bool broken_resolver(struct daemon *daemon)
|
|||
|
||||
/* If they told us to never do DNS queries, don't even do this one and
|
||||
* also not if we just say that we don't */
|
||||
if (!daemon->use_dns || daemon->use_proxy_always) {
|
||||
if (!daemon->use_dns || daemon->always_use_proxy) {
|
||||
daemon->broken_resolver_response = NULL;
|
||||
return false;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ static struct io_plan *conn_proxy_init(struct io_conn *conn,
|
|||
static void try_connect_one_addr(struct connecting *connect)
|
||||
{
|
||||
int fd, af;
|
||||
bool use_proxy = connect->daemon->use_proxy_always;
|
||||
bool use_proxy = connect->daemon->always_use_proxy;
|
||||
const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
|
||||
struct io_conn *conn;
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ static struct io_plan *connect_init(struct io_conn *conn,
|
|||
&daemon->id,
|
||||
&proposed_wireaddr,
|
||||
&proposed_listen_announce,
|
||||
&proxyaddr, &daemon->use_proxy_always,
|
||||
&proxyaddr, &daemon->always_use_proxy,
|
||||
&daemon->dev_allow_localhost, &daemon->use_dns,
|
||||
&tor_password,
|
||||
&daemon->use_v3_autotor,
|
||||
|
@ -1528,7 +1528,7 @@ static void try_connect_peer(struct daemon *daemon,
|
|||
struct wireaddr_internal *addrhint)
|
||||
{
|
||||
struct wireaddr_internal *addrs;
|
||||
bool use_proxy = daemon->use_proxy_always;
|
||||
bool use_proxy = daemon->always_use_proxy;
|
||||
struct connecting *connect;
|
||||
|
||||
/* Already done? May happen with timer. */
|
||||
|
|
|
@ -302,7 +302,7 @@ simple JSON object containing the options:
|
|||
"port": 9050
|
||||
},
|
||||
"torv3-enabled": true,
|
||||
"use_proxy_always": false
|
||||
"always_use_proxy": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -165,7 +165,7 @@ static struct command_result *json_connect(struct command *cmd,
|
|||
}
|
||||
addr = tal(cmd, struct wireaddr_internal);
|
||||
if (!parse_wireaddr_internal(name, addr, *port, false,
|
||||
!cmd->ld->use_proxy_always
|
||||
!cmd->ld->always_use_proxy
|
||||
&& !cmd->ld->pure_tor_setup,
|
||||
true, deprecated_apis,
|
||||
&err_msg)) {
|
||||
|
@ -390,7 +390,7 @@ int connectd_init(struct lightningd *ld)
|
|||
&ld->id,
|
||||
wireaddrs,
|
||||
listen_announce,
|
||||
ld->proxyaddr, ld->use_proxy_always || ld->pure_tor_setup,
|
||||
ld->proxyaddr, ld->always_use_proxy || ld->pure_tor_setup,
|
||||
IFDEV(ld->dev_allow_localhost, false), ld->config.use_dns,
|
||||
ld->tor_service_password ? ld->tor_service_password : "",
|
||||
ld->config.use_v3_autotor,
|
||||
|
|
|
@ -225,7 +225,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
|||
ld->topology = new_topology(ld, ld->log);
|
||||
ld->daemon_parent_fd = -1;
|
||||
ld->proxyaddr = NULL;
|
||||
ld->use_proxy_always = false;
|
||||
ld->always_use_proxy = false;
|
||||
ld->pure_tor_setup = false;
|
||||
ld->tor_service_password = NULL;
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ struct lightningd {
|
|||
|
||||
/* tor support */
|
||||
struct wireaddr *proxyaddr;
|
||||
bool use_proxy_always;
|
||||
bool always_use_proxy;
|
||||
char *tor_service_password;
|
||||
bool pure_tor_setup;
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ static char *opt_add_addr_withtype(const char *arg,
|
|||
tal_arr_expand(&ld->proposed_listen_announce, ala);
|
||||
if (!parse_wireaddr_internal(arg, &wi,
|
||||
ld->portnum,
|
||||
wildcard_ok, !ld->use_proxy_always, false,
|
||||
wildcard_ok, !ld->always_use_proxy, false,
|
||||
deprecated_apis, &err_msg)) {
|
||||
return tal_fmt(NULL, "Unable to parse address '%s': %s", arg, err_msg);
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ static char *opt_add_proxy_addr(const char *arg, struct lightningd *ld)
|
|||
ld->proxyaddr = tal_arr(ld, struct wireaddr, 1);
|
||||
|
||||
if (!parse_wireaddr(arg, ld->proxyaddr, 9050,
|
||||
ld->use_proxy_always ? &needed_dns : NULL,
|
||||
ld->always_use_proxy ? &needed_dns : NULL,
|
||||
NULL)) {
|
||||
return tal_fmt(NULL, "Unable to parse Tor proxy address '%s' %s",
|
||||
arg, needed_dns ? " (needed dns)" : "");
|
||||
|
@ -787,7 +787,7 @@ static void check_config(struct lightningd *ld)
|
|||
if (ld->config.anchor_confirms == 0)
|
||||
fatal("anchor-confirms must be greater than zero");
|
||||
|
||||
if (ld->use_proxy_always && !ld->proxyaddr)
|
||||
if (ld->always_use_proxy && !ld->proxyaddr)
|
||||
fatal("--always-use-proxy needs --proxy");
|
||||
|
||||
if (ld->daemon_parent_fd != -1 && !ld->logfile)
|
||||
|
@ -922,7 +922,7 @@ static void register_opts(struct lightningd *ld)
|
|||
/* Early, as it suppresses DNS lookups from cmdline too. */
|
||||
opt_register_early_arg("--always-use-proxy",
|
||||
opt_set_bool_arg, opt_show_bool,
|
||||
&ld->use_proxy_always, "Use the proxy always");
|
||||
&ld->always_use_proxy, "Use the proxy always");
|
||||
|
||||
/* This immediately makes is a daemon. */
|
||||
opt_register_early_noarg("--daemon", opt_start_daemon, ld,
|
||||
|
@ -1267,7 +1267,7 @@ void handle_opts(struct lightningd *ld, int argc, char *argv[])
|
|||
if (argc != 1)
|
||||
errx(1, "no arguments accepted");
|
||||
|
||||
/* We keep a separate variable rather than overriding use_proxy_always,
|
||||
/* We keep a separate variable rather than overriding always_use_proxy,
|
||||
* so listconfigs shows the correct thing. */
|
||||
if (tal_count(ld->proposed_wireaddr) != 0
|
||||
&& all_tor_addresses(ld->proposed_wireaddr)) {
|
||||
|
|
|
@ -1821,7 +1821,10 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req)
|
|||
if (ld->proxyaddr) {
|
||||
json_add_address(req->stream, "proxy", ld->proxyaddr);
|
||||
json_add_bool(req->stream, "torv3-enabled", ld->config.use_v3_autotor);
|
||||
json_add_bool(req->stream, "use_proxy_always", ld->use_proxy_always);
|
||||
json_add_bool(req->stream, "always_use_proxy", ld->always_use_proxy);
|
||||
if (deprecated_apis)
|
||||
json_add_bool(req->stream, "use_proxy_always",
|
||||
ld->always_use_proxy);
|
||||
}
|
||||
json_object_start(req->stream, "feature_set");
|
||||
for (enum feature_place fp = 0; fp < NUM_FEATURE_PLACE; fp++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue