Skip to content

Commit 7d7731c

Browse files
m-schmoockkandycoder
authored andcommitted
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'
1 parent 6279419 commit 7d7731c

File tree

7 files changed

+19
-16
lines changed

7 files changed

+19
-16
lines changed

connectd/connectd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct daemon {
145145
struct addrinfo *proxyaddr;
146146

147147
/* They can tell us we must use proxy even for non-Tor addresses. */
148-
bool use_proxy_always;
148+
bool always_use_proxy;
149149

150150
/* There are DNS seeds we can use to look up node addresses as a last
151151
* resort, but doing so leaks our address so can be disabled. */
@@ -216,7 +216,7 @@ static bool broken_resolver(struct daemon *daemon)
216216

217217
/* If they told us to never do DNS queries, don't even do this one and
218218
* also not if we just say that we don't */
219-
if (!daemon->use_dns || daemon->use_proxy_always) {
219+
if (!daemon->use_dns || daemon->always_use_proxy) {
220220
daemon->broken_resolver_response = NULL;
221221
return false;
222222
}
@@ -821,7 +821,7 @@ static struct io_plan *conn_proxy_init(struct io_conn *conn,
821821
static void try_connect_one_addr(struct connecting *connect)
822822
{
823823
int fd, af;
824-
bool use_proxy = connect->daemon->use_proxy_always;
824+
bool use_proxy = connect->daemon->always_use_proxy;
825825
const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
826826
struct io_conn *conn;
827827

@@ -1312,7 +1312,7 @@ static struct io_plan *connect_init(struct io_conn *conn,
13121312
&daemon->id,
13131313
&proposed_wireaddr,
13141314
&proposed_listen_announce,
1315-
&proxyaddr, &daemon->use_proxy_always,
1315+
&proxyaddr, &daemon->always_use_proxy,
13161316
&daemon->dev_allow_localhost, &daemon->use_dns,
13171317
&tor_password,
13181318
&daemon->use_v3_autotor,
@@ -1528,7 +1528,7 @@ static void try_connect_peer(struct daemon *daemon,
15281528
struct wireaddr_internal *addrhint)
15291529
{
15301530
struct wireaddr_internal *addrs;
1531-
bool use_proxy = daemon->use_proxy_always;
1531+
bool use_proxy = daemon->always_use_proxy;
15321532
struct connecting *connect;
15331533

15341534
/* Already done? May happen with timer. */

doc/PLUGINS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ simple JSON object containing the options:
302302
"port": 9050
303303
},
304304
"torv3-enabled": true,
305-
"use_proxy_always": false
305+
"always_use_proxy": false
306306
}
307307
}
308308
```

lightningd/connect_control.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static struct command_result *json_connect(struct command *cmd,
165165
}
166166
addr = tal(cmd, struct wireaddr_internal);
167167
if (!parse_wireaddr_internal(name, addr, *port, false,
168-
!cmd->ld->use_proxy_always
168+
!cmd->ld->always_use_proxy
169169
&& !cmd->ld->pure_tor_setup,
170170
true, deprecated_apis,
171171
&err_msg)) {
@@ -390,7 +390,7 @@ int connectd_init(struct lightningd *ld)
390390
&ld->id,
391391
wireaddrs,
392392
listen_announce,
393-
ld->proxyaddr, ld->use_proxy_always || ld->pure_tor_setup,
393+
ld->proxyaddr, ld->always_use_proxy || ld->pure_tor_setup,
394394
IFDEV(ld->dev_allow_localhost, false), ld->config.use_dns,
395395
ld->tor_service_password ? ld->tor_service_password : "",
396396
ld->config.use_v3_autotor,

lightningd/lightningd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
225225
ld->topology = new_topology(ld, ld->log);
226226
ld->daemon_parent_fd = -1;
227227
ld->proxyaddr = NULL;
228-
ld->use_proxy_always = false;
228+
ld->always_use_proxy = false;
229229
ld->pure_tor_setup = false;
230230
ld->tor_service_password = NULL;
231231

lightningd/lightningd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ struct lightningd {
251251

252252
/* tor support */
253253
struct wireaddr *proxyaddr;
254-
bool use_proxy_always;
254+
bool always_use_proxy;
255255
char *tor_service_password;
256256
bool pure_tor_setup;
257257

lightningd/options.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static char *opt_add_addr_withtype(const char *arg,
213213
tal_arr_expand(&ld->proposed_listen_announce, ala);
214214
if (!parse_wireaddr_internal(arg, &wi,
215215
ld->portnum,
216-
wildcard_ok, !ld->use_proxy_always, false,
216+
wildcard_ok, !ld->always_use_proxy, false,
217217
deprecated_apis, &err_msg)) {
218218
return tal_fmt(NULL, "Unable to parse address '%s': %s", arg, err_msg);
219219
}
@@ -406,7 +406,7 @@ static char *opt_add_proxy_addr(const char *arg, struct lightningd *ld)
406406
ld->proxyaddr = tal_arr(ld, struct wireaddr, 1);
407407

408408
if (!parse_wireaddr(arg, ld->proxyaddr, 9050,
409-
ld->use_proxy_always ? &needed_dns : NULL,
409+
ld->always_use_proxy ? &needed_dns : NULL,
410410
NULL)) {
411411
return tal_fmt(NULL, "Unable to parse Tor proxy address '%s' %s",
412412
arg, needed_dns ? " (needed dns)" : "");
@@ -787,7 +787,7 @@ static void check_config(struct lightningd *ld)
787787
if (ld->config.anchor_confirms == 0)
788788
fatal("anchor-confirms must be greater than zero");
789789

790-
if (ld->use_proxy_always && !ld->proxyaddr)
790+
if (ld->always_use_proxy && !ld->proxyaddr)
791791
fatal("--always-use-proxy needs --proxy");
792792

793793
if (ld->daemon_parent_fd != -1 && !ld->logfile)
@@ -922,7 +922,7 @@ static void register_opts(struct lightningd *ld)
922922
/* Early, as it suppresses DNS lookups from cmdline too. */
923923
opt_register_early_arg("--always-use-proxy",
924924
opt_set_bool_arg, opt_show_bool,
925-
&ld->use_proxy_always, "Use the proxy always");
925+
&ld->always_use_proxy, "Use the proxy always");
926926

927927
/* This immediately makes is a daemon. */
928928
opt_register_early_noarg("--daemon", opt_start_daemon, ld,
@@ -1267,7 +1267,7 @@ void handle_opts(struct lightningd *ld, int argc, char *argv[])
12671267
if (argc != 1)
12681268
errx(1, "no arguments accepted");
12691269

1270-
/* We keep a separate variable rather than overriding use_proxy_always,
1270+
/* We keep a separate variable rather than overriding always_use_proxy,
12711271
* so listconfigs shows the correct thing. */
12721272
if (tal_count(ld->proposed_wireaddr) != 0
12731273
&& all_tor_addresses(ld->proposed_wireaddr)) {

lightningd/plugin.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,10 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req)
18211821
if (ld->proxyaddr) {
18221822
json_add_address(req->stream, "proxy", ld->proxyaddr);
18231823
json_add_bool(req->stream, "torv3-enabled", ld->config.use_v3_autotor);
1824-
json_add_bool(req->stream, "use_proxy_always", ld->use_proxy_always);
1824+
json_add_bool(req->stream, "always_use_proxy", ld->always_use_proxy);
1825+
if (deprecated_apis)
1826+
json_add_bool(req->stream, "use_proxy_always",
1827+
ld->always_use_proxy);
18251828
}
18261829
json_object_start(req->stream, "feature_set");
18271830
for (enum feature_place fp = 0; fp < NUM_FEATURE_PLACE; fp++) {

0 commit comments

Comments
 (0)