Commit c51e3e6
feat: add Tor SOCKS5 proxy support for outbound .onion connections
Implement SOCKS5 protocol in connection.rs to route outbound peer
connections through a Tor proxy. This enables LDK nodes to connect
to peers at .onion addresses.
Changes:
- Add tor_socks5_connect() with full SOCKS5 handshake (RFC 1928/1929)
- Support Tor stream isolation via random password auth per connection
- Add set_tor_proxy_address() on NodeBuilder (FFI-compatible via UDL)
- Route OnionV3 addresses through SOCKS5, clearnet through direct TCP
- Include base32 encoder for OnionV3 address derivation
Based on the approach in upstream ldk-node PR lightningdevkit#778, but with a
self-contained SOCKS5 implementation that doesn't depend on unreleased
lightning_net_tokio::tor_connect_outbound().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 99d12f4 commit c51e3e6
3 files changed
+696
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
593 | 595 | | |
594 | 596 | | |
595 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
596 | 608 | | |
597 | 609 | | |
598 | 610 | | |
| |||
985 | 997 | | |
986 | 998 | | |
987 | 999 | | |
| 1000 | + | |
988 | 1001 | | |
989 | 1002 | | |
990 | 1003 | | |
| |||
1037 | 1050 | | |
1038 | 1051 | | |
1039 | 1052 | | |
| 1053 | + | |
1040 | 1054 | | |
1041 | 1055 | | |
1042 | 1056 | | |
| |||
1304 | 1318 | | |
1305 | 1319 | | |
1306 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1307 | 1334 | | |
1308 | 1335 | | |
1309 | 1336 | | |
| |||
1416 | 1443 | | |
1417 | 1444 | | |
1418 | 1445 | | |
| 1446 | + | |
1419 | 1447 | | |
1420 | 1448 | | |
1421 | 1449 | | |
| |||
2023 | 2051 | | |
2024 | 2052 | | |
2025 | 2053 | | |
2026 | | - | |
2027 | | - | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
2028 | 2060 | | |
2029 | 2061 | | |
2030 | 2062 | | |
| |||
0 commit comments