mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 01:09:14 +01:00
net: Automatically create hidden service, listen on Tor
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket API, to create and destroy 'ephemeral' hidden services programmatically. https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service This means that if Tor is running (and proper authorization is available), bitcoin automatically creates a hidden service to listen on, without user manual configuration. This will positively affect the number of available .onion nodes. - When the node is started, connect to Tor through control socket - Send `ADD_ONION` command - First time: - Make it create a hidden service key - Save the key in the data directory for later usage - Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on). - Keep control socket connection open for as long node is running. The hidden service will (by default) automatically go away when the connection is closed.
This commit is contained in:
19
src/torcontrol.h
Normal file
19
src/torcontrol.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
/**
|
||||
* Functionality for communicating with Tor.
|
||||
*/
|
||||
#ifndef BITCOIN_TORCONTROL_H
|
||||
#define BITCOIN_TORCONTROL_H
|
||||
|
||||
#include "scheduler.h"
|
||||
|
||||
extern const std::string DEFAULT_TOR_CONTROL;
|
||||
static const bool DEFAULT_LISTEN_ONION = true;
|
||||
|
||||
void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler);
|
||||
void StopTorControl();
|
||||
|
||||
#endif /* BITCOIN_TORCONTROL_H */
|
||||
Reference in New Issue
Block a user