diff options
| author | Bitflash <admin@bitflash.network> | 2026-08-12 10:22:23 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-12 10:22:23 -0300 |
| commit | d0ebe648f333def99fababd65f6b929448616d56 (patch) | |
| tree | c7ccaa28b9f83abd077ba90c031632deda83c80a /src/main_gui.cpp | |
| parent | c330b8e5e1c057049b5b361908c94f41344dff80 (diff) | |
| parent | a0a300c240c91fa0c1cd1dc60ff5420a89cc33f8 (diff) | |
Merge pull request 'net: add Tor mode for outbound discovery' (#28) from tor-mode into main
Diffstat (limited to 'src/main_gui.cpp')
| -rw-r--r-- | src/main_gui.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 90a6050..bef8503 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,35 @@ 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 socksProxy = argval2(argc, argv, "/socks", "-socks"); | ||
| 293 | if (!socksProxy.empty()) | ||
| 294 | fprintf(stderr, "Warning: /tor takes precedence over /socks=%s\n", | ||
| 295 | socksProxy.c_str()); | ||
| 296 | |||
| 297 | string torProxy = argval2(argc, argv, "/tor", "-tor"); | ||
| 291 | string err; | 298 | string err; |
| 292 | if (!BtfSetSocks5Proxy(socksProxy, err)) | 299 | if (!BtfEnableTorProxy(torProxy, err)) |
| 293 | fprintf(stderr, "Ignoring /socks=%s: %s\n", socksProxy.c_str(), err.c_str()); | 300 | fprintf(stderr, "Ignoring /tor=%s: %s\n", torProxy.c_str(), err.c_str()); |
| 294 | else | 301 | else |
| 295 | fprintf(stderr, "SOCKS5 proxy enabled for outbound discovery/relay dials: %s\n", | 302 | fprintf(stderr, "Tor mode enabled through SOCKS5 proxy %s\n", |
| 296 | BtfSocks5ProxyName().c_str()); | 303 | BtfSocks5ProxyName().c_str()); |
| 297 | } | 304 | } |
| 305 | else | ||
| 306 | { | ||
| 307 | string socksProxy = argval2(argc, argv, "/socks", "-socks"); | ||
| 308 | if (!socksProxy.empty()) | ||
| 309 | { | ||
| 310 | string err; | ||
| 311 | if (!BtfSetSocks5Proxy(socksProxy, err)) | ||
| 312 | fprintf(stderr, "Ignoring /socks=%s: %s\n", socksProxy.c_str(), err.c_str()); | ||
| 313 | else | ||
| 314 | fprintf(stderr, "SOCKS5 proxy enabled for outbound discovery/relay dials: %s\n", | ||
| 315 | BtfSocks5ProxyName().c_str()); | ||
| 316 | } | ||
| 317 | } | ||
| 298 | 318 | ||
| 299 | // /btfseed=ADDRESS:ENCHEX -- extra bootstrap peers, repeatable. Useful for | 319 | // /btfseed=ADDRESS:ENCHEX -- extra bootstrap peers, repeatable. Useful for |
| 300 | // testing the seed path and for private networks that ship no compiled list. | 320 | // testing the seed path and for private networks that ship no compiled list. |