upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorNsable-sh <nsable-sh@noreply.git.bitflash.network>2026-08-11 16:03:12 -0300
committerNsable-sh <nsable-sh@noreply.git.bitflash.network>2026-08-11 16:03:12 -0300
commit6092e1e7da199d6c15b9548d5d4cebcf8babfdcf (patch)
treec5870b95d13abe80d1350f0a028f6f658b61b3ae /src/main_gui.cpp
parent066379ebcb1dac720221fe1a1841fa6f59df21d9 (diff)
net: add Tor mode for outbound discovery
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 90a6050..5194023 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -138,6 +138,7 @@ static void PrintUsage()
138 printf("Network:\n"); 138 printf("Network:\n");
139 printf(" /port=N (P2P listen port, default 8433)\n"); 139 printf(" /port=N (P2P listen port, default 8433)\n");
140 printf(" /socks=HOST:PORT (SOCKS5 proxy for outbound Nostr and .btf relay dials)\n"); 140 printf(" /socks=HOST:PORT (SOCKS5 proxy for outbound Nostr and .btf relay dials)\n");
141 printf(" /tor[=HOST:PORT] (Tor mode; default SOCKS5 proxy is 127.0.0.1:9050)\n");
141 printf(" /btfseed=ADDRESS:ENCHEX (extra bootstrap peer, repeatable)\n"); 142 printf(" /btfseed=ADDRESS:ENCHEX (extra bootstrap peer, repeatable)\n");
142 printf("\n"); 143 printf("\n");
143 printf("Wallet:\n"); 144 printf("Wallet:\n");
@@ -285,16 +286,30 @@ static void ParseStartupArguments(int argc, char* argv[])
285 if (!announceRelay.empty()) 286 if (!announceRelay.empty())
286 strBtfAnnounceRelay = announceRelay; 287 strBtfAnnounceRelay = announceRelay;
287 288
288 string socksProxy = argval2(argc, argv, "/socks", "-socks"); 289 bool fTorMode = arg(argc, argv, "/tor") || arg(argc, argv, "-tor");
289 if (!socksProxy.empty()) 290 if (fTorMode)
290 { 291 {
292 string torProxy = argval2(argc, argv, "/tor", "-tor");
291 string err; 293 string err;
292 if (!BtfSetSocks5Proxy(socksProxy, err)) 294 if (!BtfEnableTorProxy(torProxy, err))
293 fprintf(stderr, "Ignoring /socks=%s: %s\n", socksProxy.c_str(), err.c_str()); 295 fprintf(stderr, "Ignoring /tor=%s: %s\n", torProxy.c_str(), err.c_str());
294 else 296 else
295 fprintf(stderr, "SOCKS5 proxy enabled for outbound discovery/relay dials: %s\n", 297 fprintf(stderr, "Tor mode enabled through SOCKS5 proxy %s\n",
296 BtfSocks5ProxyName().c_str()); 298 BtfSocks5ProxyName().c_str());
297 } 299 }
300 else
301 {
302 string socksProxy = argval2(argc, argv, "/socks", "-socks");
303 if (!socksProxy.empty())
304 {
305 string err;
306 if (!BtfSetSocks5Proxy(socksProxy, err))
307 fprintf(stderr, "Ignoring /socks=%s: %s\n", socksProxy.c_str(), err.c_str());
308 else
309 fprintf(stderr, "SOCKS5 proxy enabled for outbound discovery/relay dials: %s\n",
310 BtfSocks5ProxyName().c_str());
311 }
312 }
298 313
299 // /btfseed=ADDRESS:ENCHEX -- extra bootstrap peers, repeatable. Useful for 314 // /btfseed=ADDRESS:ENCHEX -- extra bootstrap peers, repeatable. Useful for
300 // testing the seed path and for private networks that ship no compiled list. 315 // testing the seed path and for private networks that ship no compiled list.