diff options
| author | Bitflash <admin@bitflash.network> | 2026-08-13 16:52:54 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-13 16:52:54 -0300 |
| commit | 111da0606d0a82703dacba815fdf809ad86e3f6a (patch) | |
| tree | 0a792fc17aa0f123cb713ad81c797ccd2129284c /src/net.cpp | |
| parent | ea08342aba66400f588c6a03685a6f39927cb062 (diff) | |
| parent | 792e6cece49925b90e70b3e3e160c00678c89536 (diff) | |
Merge pull request 'net: show Tor transport in diagnostics' (#36) from tor-diagnostics into main
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 997a2bd..3660735 100644 --- a/src/net.cpp +++ b/src/net.cpp | |||
| @@ -268,15 +268,21 @@ string GetDiagnosticsText() | |||
| 268 | int64 nNow = GetTime(); | 268 | int64 nNow = GetTime(); |
| 269 | string str; | 269 | string str; |
| 270 | 270 | ||
| 271 | int nInbound = 0, nHeld = 0; | 271 | int nInbound = 0, nHeld = 0, nDirectOnion = 0, nRendezvous = 0; |
| 272 | vector<CNode*> vCopy; | 272 | vector<CNode*> vCopy; |
| 273 | CRITICAL_BLOCK(cs_vNodes) | 273 | CRITICAL_BLOCK(cs_vNodes) |
| 274 | { | 274 | { |
| 275 | vCopy = vNodes; | 275 | vCopy = vNodes; |
| 276 | nHeld = (int)vNodes.size(); | 276 | nHeld = (int)vNodes.size(); |
| 277 | foreach(CNode* pnode, vNodes) | 277 | foreach(CNode* pnode, vNodes) |
| 278 | { | ||
| 278 | if (pnode->fInbound) | 279 | if (pnode->fInbound) |
| 279 | nInbound++; | 280 | nInbound++; |
| 281 | if (pnode->strBtfMeeting.find(".onion:") != string::npos) | ||
| 282 | nDirectOnion++; | ||
| 283 | else if (!pnode->strBtfMeeting.empty()) | ||
| 284 | nRendezvous++; | ||
| 285 | } | ||
| 280 | } | 286 | } |
| 281 | 287 | ||
| 282 | int nMedian = GetPeerMedianHeight(); | 288 | int nMedian = GetPeerMedianHeight(); |
| @@ -301,6 +307,22 @@ string GetDiagnosticsText() | |||
| 301 | nHeld > nPeersWatched ? " <-- NOT ALL PEERS ARE BEING READ" : ""); | 307 | nHeld > nPeersWatched ? " <-- NOT ALL PEERS ARE BEING READ" : ""); |
| 302 | str += strprintf(" managed Tor %s\n", BtfManagedTorStatus().c_str()); | 308 | str += strprintf(" managed Tor %s\n", BtfManagedTorStatus().c_str()); |
| 303 | 309 | ||
| 310 | string strTorMode = "disabled"; | ||
| 311 | if (BtfManagedTorEnabled()) | ||
| 312 | strTorMode = "managed"; | ||
| 313 | else if (BtfTorProxyEnabled()) | ||
| 314 | strTorMode = "external"; | ||
| 315 | else if (BtfSocks5ProxyEnabled()) | ||
| 316 | strTorMode = "socks5"; | ||
| 317 | string strOnion = BtfLocalOnionEndpoint(); | ||
| 318 | str += strprintf(" Tor mode %s%s\n", | ||
| 319 | strTorMode.c_str(), | ||
| 320 | fBtfOnionOnly ? " (onion-only)" : ""); | ||
| 321 | str += strprintf(" onion endpoint %s\n", | ||
| 322 | strOnion.empty() ? "none" : strOnion.c_str()); | ||
| 323 | str += strprintf(" .btf peers %d direct onion, %d rendezvous\n", | ||
| 324 | nDirectOnion, nRendezvous); | ||
| 325 | |||
| 304 | if (nBlocksReceived > 0) | 326 | if (nBlocksReceived > 0) |
| 305 | str += strprintf(" blocks received %lld (%lld arrived without a parent, %.1f%%)\n", | 327 | str += strprintf(" blocks received %lld (%lld arrived without a parent, %.1f%%)\n", |
| 306 | (long long)nBlocksReceived, (long long)nBlocksWithoutParent, | 328 | (long long)nBlocksReceived, (long long)nBlocksWithoutParent, |