Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
TorController Class Reference

Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral onion service. More...

#include <torcontrol.h>

Collaboration diagram for TorController:
[legend]

Public Member Functions

 TorController (struct event_base *base, const std::string &tor_control_center, const CService &target)
 TorController ()
 ~TorController ()
fs::path GetPrivateKeyFile ()
 Get name of file to store private key in.
void Reconnect ()
 Reconnect, after getting disconnected.
void get_socks_cb (TorControlConnection &conn, const TorControlReply &reply)
 Callback for GETINFO net/listeners/socks result.
void add_onion_cb (TorControlConnection &conn, const TorControlReply &reply)
 Callback for ADD_ONION result.
void auth_cb (TorControlConnection &conn, const TorControlReply &reply)
 Callback for AUTHENTICATE result.
void authchallenge_cb (TorControlConnection &conn, const TorControlReply &reply)
 Callback for AUTHCHALLENGE result.
void protocolinfo_cb (TorControlConnection &conn, const TorControlReply &reply)
 Callback for PROTOCOLINFO result.
void connected_cb (TorControlConnection &conn)
 Callback after successful connection.
void disconnected_cb (TorControlConnection &conn)
 Callback after connection lost or failed connection attempt.

Static Public Member Functions

static void reconnect_cb (evutil_socket_t fd, short what, void *arg)
 Callback for reconnect timer.

Private Attributes

struct event_base * base
const std::string m_tor_control_center
TorControlConnection conn
std::string private_key
std::string service_id
bool reconnect
struct event * reconnect_ev = nullptr
float reconnect_timeout
CService service
const CService m_target
std::vector< uint8_t > cookie
 Cookie for SAFECOOKIE auth.
std::vector< uint8_t > clientNonce
 ClientNonce for SAFECOOKIE auth.

Detailed Description

Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral onion service.

Definition at line 107 of file torcontrol.h.

Constructor & Destructor Documentation

◆ TorController() [1/2]

TorController::TorController ( struct event_base * base,
const std::string & tor_control_center,
const CService & target )

Definition at line 326 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TorController() [2/2]

TorController::TorController ( )
inline

Definition at line 111 of file torcontrol.h.

◆ ~TorController()

TorController::~TorController ( )

Definition at line 347 of file torcontrol.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ add_onion_cb()

void TorController::add_onion_cb ( TorControlConnection & conn,
const TorControlReply & reply )

Callback for ADD_ONION result.

Definition at line 429 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ auth_cb()

void TorController::auth_cb ( TorControlConnection & conn,
const TorControlReply & reply )

Callback for AUTHENTICATE result.

Definition at line 464 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ authchallenge_cb()

void TorController::authchallenge_cb ( TorControlConnection & conn,
const TorControlReply & reply )

Callback for AUTHCHALLENGE result.

Definition at line 515 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connected_cb()

void TorController::connected_cb ( TorControlConnection & conn)

Callback after successful connection.

Definition at line 626 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnected_cb()

void TorController::disconnected_cb ( TorControlConnection & conn)

Callback after connection lost or failed connection attempt.

Definition at line 634 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_socks_cb()

void TorController::get_socks_cb ( TorControlConnection & conn,
const TorControlReply & reply )

Callback for GETINFO net/listeners/socks result.

Definition at line 358 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPrivateKeyFile()

fs::path TorController::GetPrivateKeyFile ( )

Get name of file to store private key in.

Definition at line 665 of file torcontrol.cpp.

Here is the caller graph for this function:

◆ protocolinfo_cb()

void TorController::protocolinfo_cb ( TorControlConnection & conn,
const TorControlReply & reply )

Callback for PROTOCOLINFO result.

Definition at line 550 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reconnect()

void TorController::Reconnect ( )

Reconnect, after getting disconnected.

Definition at line 654 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reconnect_cb()

void TorController::reconnect_cb ( evutil_socket_t fd,
short what,
void * arg )
static

Callback for reconnect timer.

Definition at line 670 of file torcontrol.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ base

struct event_base* TorController::base
private

Definition at line 122 of file torcontrol.h.

◆ clientNonce

std::vector<uint8_t> TorController::clientNonce
private

ClientNonce for SAFECOOKIE auth.

Definition at line 135 of file torcontrol.h.

◆ conn

TorControlConnection TorController::conn
private

Definition at line 124 of file torcontrol.h.

◆ cookie

std::vector<uint8_t> TorController::cookie
private

Cookie for SAFECOOKIE auth.

Definition at line 133 of file torcontrol.h.

◆ m_target

const CService TorController::m_target
private

Definition at line 131 of file torcontrol.h.

◆ m_tor_control_center

const std::string TorController::m_tor_control_center
private

Definition at line 123 of file torcontrol.h.

◆ private_key

std::string TorController::private_key
private

Definition at line 125 of file torcontrol.h.

◆ reconnect

bool TorController::reconnect
private

Definition at line 127 of file torcontrol.h.

◆ reconnect_ev

struct event* TorController::reconnect_ev = nullptr
private

Definition at line 128 of file torcontrol.h.

◆ reconnect_timeout

float TorController::reconnect_timeout
private

Definition at line 129 of file torcontrol.h.

◆ service

CService TorController::service
private

Definition at line 130 of file torcontrol.h.

◆ service_id

std::string TorController::service_id
private

Definition at line 126 of file torcontrol.h.


The documentation for this class was generated from the following files: