From 0ae3058a7f871acb533fbc10b662295774d71fe6 Mon Sep 17 00:00:00 2001 From: Nsable-sh Date: Thu, 13 Aug 2026 16:15:40 -0300 Subject: net: show Tor transport in diagnostics --- src/net.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index 997a2bd..16aaa6e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -268,15 +268,21 @@ string GetDiagnosticsText() int64 nNow = GetTime(); string str; - int nInbound = 0, nHeld = 0; + int nInbound = 0, nHeld = 0, nDirectOnion = 0, nRendezvous = 0; vector vCopy; CRITICAL_BLOCK(cs_vNodes) { vCopy = vNodes; nHeld = (int)vNodes.size(); foreach(CNode* pnode, vNodes) + { if (pnode->fInbound) nInbound++; + if (pnode->strBtfMeeting.compare(0, 6, "onion ") == 0) + nDirectOnion++; + else if (!pnode->strBtfMeeting.empty()) + nRendezvous++; + } } int nMedian = GetPeerMedianHeight(); @@ -301,6 +307,22 @@ string GetDiagnosticsText() nHeld > nPeersWatched ? " <-- NOT ALL PEERS ARE BEING READ" : ""); str += strprintf(" managed Tor %s\n", BtfManagedTorStatus().c_str()); + string strTorMode = "disabled"; + if (BtfManagedTorEnabled()) + strTorMode = "managed"; + else if (BtfTorProxyEnabled()) + strTorMode = "external"; + else if (BtfSocks5ProxyEnabled()) + strTorMode = "socks5"; + string strOnion = BtfLocalOnionEndpoint(); + str += strprintf(" Tor mode %s%s\n", + strTorMode.c_str(), + fBtfOnionOnly ? " (onion-only)" : ""); + str += strprintf(" onion endpoint %s\n", + strOnion.empty() ? "none" : strOnion.c_str()); + str += strprintf(" .btf peers %d direct onion, %d rendezvous\n", + nDirectOnion, nRendezvous); + if (nBlocksReceived > 0) str += strprintf(" blocks received %lld (%lld arrived without a parent, %.1f%%)\n", (long long)nBlocksReceived, (long long)nBlocksWithoutParent, -- cgit v1.2.3