Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral hidden service. More...
Public Member Functions | |
TorController (struct event_base *base, const std::string &target) | |
~TorController () | |
fs::path | GetPrivateKeyFile () |
Get name fo file to store private key in. More... | |
void | Reconnect () |
Reconnect, after getting disconnected. More... | |
Private Member Functions | |
void | add_onion_cb (TorControlConnection &conn, const TorControlReply &reply) |
Callback for ADD_ONION result. More... | |
void | auth_cb (TorControlConnection &conn, const TorControlReply &reply) |
Callback for AUTHENTICATE result. More... | |
void | authchallenge_cb (TorControlConnection &conn, const TorControlReply &reply) |
Callback for AUTHCHALLENGE result. More... | |
void | protocolinfo_cb (TorControlConnection &conn, const TorControlReply &reply) |
Callback for PROTOCOLINFO result. More... | |
void | connected_cb (TorControlConnection &conn) |
Callback after successful connection. More... | |
void | disconnected_cb (TorControlConnection &conn) |
Callback after connection lost or failed connection attempt. More... | |
Static Private Member Functions | |
static void | reconnect_cb (evutil_socket_t fd, short what, void *arg) |
Callback for reconnect timer. More... | |
Private Attributes | |
struct event_base * | base |
std::string | target |
TorControlConnection | conn |
std::string | private_key |
std::string | service_id |
bool | reconnect |
struct event * | reconnect_ev |
float | reconnect_timeout |
CService | service |
std::vector< uint8_t > | cookie |
Cookie for SAFECOOKIE auth. More... | |
std::vector< uint8_t > | clientNonce |
ClientNonce for SAFECOOKIE auth. More... | |
Detailed Description
Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral hidden service.
Definition at line 411 of file torcontrol.cpp.
Constructor & Destructor Documentation
◆ TorController()
TorController::TorController | ( | struct event_base * | base, |
const std::string & | target | ||
) |
Definition at line 454 of file torcontrol.cpp.
References base, conn, TorControlConnection::Connect(), connected_cb(), disconnected_cb(), GetPrivateKeyFile(), LogPrint, LogPrintf, private_key, ReadBinaryFile(), reconnect_cb(), reconnect_ev, and BCLog::TOR.
◆ ~TorController()
TorController::~TorController | ( | ) |
Definition at line 475 of file torcontrol.cpp.
References CNetAddr::IsValid(), reconnect_ev, RemoveLocal(), and service.
Member Function Documentation
◆ add_onion_cb()
|
private |
Callback for ADD_ONION result.
Definition at line 486 of file torcontrol.cpp.
References AddLocal(), TorControlReply::code, GetListenPort(), GetPrivateKeyFile(), TorControlReply::lines, LOCAL_MANUAL, LogPrint, LogPrintf, LookupNumeric(), ParseTorReplyMapping(), private_key, SanitizeString(), service, service_id, BCLog::TOR, CService::ToString(), and WriteBinaryFile().
Referenced by auth_cb().
◆ auth_cb()
|
private |
Callback for AUTHENTICATE result.
Definition at line 521 of file torcontrol.cpp.
References add_onion_cb(), TorControlReply::code, TorControlConnection::Command(), gArgs, ArgsManager::GetArg(), GetListenPort(), LogPrint, LogPrintf, LookupNumeric(), NET_TOR, private_key, SetLimited(), SetProxy(), strprintf, and BCLog::TOR.
Referenced by authchallenge_cb(), and protocolinfo_cb().
◆ authchallenge_cb()
|
private |
Callback for AUTHCHALLENGE result.
Definition at line 575 of file torcontrol.cpp.
References auth_cb(), clientNonce, TorControlReply::code, TorControlConnection::Command(), ComputeResponse(), cookie, HexStr(), TorControlReply::lines, LogPrint, LogPrintf, ParseHex(), ParseTorReplyMapping(), SanitizeString(), SplitTorReplyLine(), BCLog::TOR, TOR_SAFE_CLIENTKEY, and TOR_SAFE_SERVERKEY.
Referenced by protocolinfo_cb().
◆ connected_cb()
|
private |
Callback after successful connection.
Definition at line 684 of file torcontrol.cpp.
References TorControlConnection::Command(), LogPrintf, protocolinfo_cb(), reconnect_timeout, and RECONNECT_TIMEOUT_START.
Referenced by Reconnect(), and TorController().
◆ disconnected_cb()
|
private |
Callback after connection lost or failed connection attempt.
Definition at line 692 of file torcontrol.cpp.
References CNetAddr::IsValid(), LogPrint, MillisToTimeval(), reconnect, reconnect_ev, reconnect_timeout, RECONNECT_TIMEOUT_EXP, RemoveLocal(), service, target, and BCLog::TOR.
Referenced by Reconnect(), and TorController().
◆ GetPrivateKeyFile()
fs::path TorController::GetPrivateKeyFile | ( | ) |
Get name fo file to store private key in.
Definition at line 721 of file torcontrol.cpp.
References GetDataDir().
Referenced by add_onion_cb(), and TorController().
◆ protocolinfo_cb()
|
private |
Callback for PROTOCOLINFO result.
Definition at line 610 of file torcontrol.cpp.
References auth_cb(), authchallenge_cb(), clientNonce, TorControlReply::code, TorControlConnection::Command(), cookie, gArgs, ArgsManager::GetArg(), GetRandBytes(), HexStr(), TorControlReply::lines, LogPrint, LogPrintf, ParseTorReplyMapping(), ReadBinaryFile(), SplitTorReplyLine(), BCLog::TOR, TOR_COOKIE_SIZE, and TOR_NONCE_SIZE.
Referenced by connected_cb().
◆ Reconnect()
void TorController::Reconnect | ( | ) |
Reconnect, after getting disconnected.
Definition at line 710 of file torcontrol.cpp.
References conn, TorControlConnection::Connect(), connected_cb(), disconnected_cb(), LogPrintf, and target.
Referenced by reconnect_cb().
◆ reconnect_cb()
|
staticprivate |
Callback for reconnect timer.
Definition at line 726 of file torcontrol.cpp.
References Reconnect().
Referenced by TorController().
Member Data Documentation
◆ base
|
private |
Definition at line 423 of file torcontrol.cpp.
Referenced by TorController().
◆ clientNonce
|
private |
ClientNonce for SAFECOOKIE auth.
Definition at line 435 of file torcontrol.cpp.
Referenced by authchallenge_cb(), and protocolinfo_cb().
◆ conn
|
private |
Definition at line 425 of file torcontrol.cpp.
Referenced by Reconnect(), and TorController().
◆ cookie
|
private |
Cookie for SAFECOOKIE auth.
Definition at line 433 of file torcontrol.cpp.
Referenced by authchallenge_cb(), and protocolinfo_cb().
◆ private_key
|
private |
Definition at line 426 of file torcontrol.cpp.
Referenced by add_onion_cb(), auth_cb(), and TorController().
◆ reconnect
|
private |
Definition at line 428 of file torcontrol.cpp.
Referenced by disconnected_cb().
◆ reconnect_ev
|
private |
Definition at line 429 of file torcontrol.cpp.
Referenced by disconnected_cb(), TorController(), and ~TorController().
◆ reconnect_timeout
|
private |
Definition at line 430 of file torcontrol.cpp.
Referenced by connected_cb(), and disconnected_cb().
◆ service
|
private |
Definition at line 431 of file torcontrol.cpp.
Referenced by add_onion_cb(), disconnected_cb(), and ~TorController().
◆ service_id
|
private |
Definition at line 427 of file torcontrol.cpp.
Referenced by add_onion_cb().
◆ target
|
private |
Definition at line 424 of file torcontrol.cpp.
Referenced by disconnected_cb(), and Reconnect().
The documentation for this class was generated from the following file:
- src/torcontrol.cpp