From c9687ab6ce338d38029a275caa10df127b557d30 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Mon, 7 Sep 2020 13:00:36 +0200 Subject: [PATCH] Added proxy information to config information for plugins Changelog-Added: Plugins: Proxy information now provided in init.configuration." Signed-off-by: Vincenzo Palazzo --- doc/PLUGINS.md | 8 ++++++++ lightningd/plugin.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/doc/PLUGINS.md b/doc/PLUGINS.md index 347abf882..88cf0a3c9 100644 --- a/doc/PLUGINS.md +++ b/doc/PLUGINS.md @@ -214,6 +214,14 @@ simple JSON object containing the options: "channel": "", "invoice": "028200" } + "startup": true, + "proxy": { + "type": "ipv4", + "address": "127.0.0.1", + "port": 9050 + } + "torv3-enabled": true, + "use_proxy_always": false } } ``` diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 1f696a2ec..43ecf48aa 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -1452,6 +1453,11 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req) json_add_string(req->stream, "rpc-file", ld->rpc_filename); json_add_bool(req->stream, "startup", plugin->plugins->startup); json_add_string(req->stream, "network", chainparams->network_name); + 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_object_start(req->stream, "feature_set"); for (enum feature_place fp = 0; fp < NUM_FEATURE_PLACE; fp++) { if (feature_place_names[fp]) {