mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
scripted-diff: remove duplicate categories from LogPrint output
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }
s 'BCLog::TOR, "tor: ' 'BCLog::TOR, "'
s 'BCLog::I2P, "I2P: ' 'BCLog::I2P, "'
s 'BCLog::NET, "net: ' 'BCLog::NET, "'
s 'BCLog::ZMQ, "zmq: ' 'BCLog::ZMQ, "'
s 'BCLog::PRUNE, "Prune: ' 'BCLog::PRUNE, "'
-END VERIFY SCRIPT-
This commit is contained in:
@@ -94,7 +94,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
|
||||
self->reply_handlers.front()(*self, self->message);
|
||||
self->reply_handlers.pop_front();
|
||||
} else {
|
||||
LogPrint(BCLog::TOR, "tor: Received unexpected sync reply %i\n", self->message.code);
|
||||
LogPrint(BCLog::TOR, "Received unexpected sync reply %i\n", self->message.code);
|
||||
}
|
||||
}
|
||||
self->message.Clear();
|
||||
@@ -113,13 +113,13 @@ void TorControlConnection::eventcb(struct bufferevent *bev, short what, void *ct
|
||||
{
|
||||
TorControlConnection *self = static_cast<TorControlConnection*>(ctx);
|
||||
if (what & BEV_EVENT_CONNECTED) {
|
||||
LogPrint(BCLog::TOR, "tor: Successfully connected!\n");
|
||||
LogPrint(BCLog::TOR, "Successfully connected!\n");
|
||||
self->connected(*self);
|
||||
} else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) {
|
||||
if (what & BEV_EVENT_ERROR) {
|
||||
LogPrint(BCLog::TOR, "tor: Error connecting to Tor control socket\n");
|
||||
LogPrint(BCLog::TOR, "Error connecting to Tor control socket\n");
|
||||
} else {
|
||||
LogPrint(BCLog::TOR, "tor: End of stream\n");
|
||||
LogPrint(BCLog::TOR, "End of stream\n");
|
||||
}
|
||||
self->Disconnect();
|
||||
self->disconnected(*self);
|
||||
@@ -318,7 +318,7 @@ TorController::TorController(struct event_base* _base, const std::string& tor_co
|
||||
// Read service private key if cached
|
||||
std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
|
||||
if (pkf.first) {
|
||||
LogPrint(BCLog::TOR, "tor: Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||
LogPrint(BCLog::TOR, "Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||
private_key = pkf.second;
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||
}
|
||||
}
|
||||
if (!socks_location.empty()) {
|
||||
LogPrint(BCLog::TOR, "tor: Get SOCKS port command yielded %s\n", socks_location);
|
||||
LogPrint(BCLog::TOR, "Get SOCKS port command yielded %s\n", socks_location);
|
||||
} else {
|
||||
LogPrintf("tor: Get SOCKS port command returned nothing\n");
|
||||
}
|
||||
@@ -380,7 +380,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||
}
|
||||
|
||||
Assume(resolved.IsValid());
|
||||
LogPrint(BCLog::TOR, "tor: Configuring onion proxy for %s\n", resolved.ToStringIPPort());
|
||||
LogPrint(BCLog::TOR, "Configuring onion proxy for %s\n", resolved.ToStringIPPort());
|
||||
Proxy addrOnion = Proxy(resolved, true);
|
||||
SetProxy(NET_ONION, addrOnion);
|
||||
|
||||
@@ -404,7 +404,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||
void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||
{
|
||||
if (reply.code == 250) {
|
||||
LogPrint(BCLog::TOR, "tor: ADD_ONION successful\n");
|
||||
LogPrint(BCLog::TOR, "ADD_ONION successful\n");
|
||||
for (const std::string &s : reply.lines) {
|
||||
std::map<std::string,std::string> m = ParseTorReplyMapping(s);
|
||||
std::map<std::string,std::string>::iterator i;
|
||||
@@ -423,7 +423,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
||||
service = LookupNumeric(std::string(service_id+".onion"), Params().GetDefaultPort());
|
||||
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
|
||||
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
|
||||
LogPrint(BCLog::TOR, "tor: Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||
LogPrint(BCLog::TOR, "Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||
} else {
|
||||
LogPrintf("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||
}
|
||||
@@ -439,7 +439,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
||||
void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||
{
|
||||
if (reply.code == 250) {
|
||||
LogPrint(BCLog::TOR, "tor: Authentication successful\n");
|
||||
LogPrint(BCLog::TOR, "Authentication successful\n");
|
||||
|
||||
// Now that we know Tor is running setup the proxy for onion addresses
|
||||
// if -onion isn't set to something else.
|
||||
@@ -490,7 +490,7 @@ static std::vector<uint8_t> ComputeResponse(const std::string &key, const std::v
|
||||
void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||
{
|
||||
if (reply.code == 250) {
|
||||
LogPrint(BCLog::TOR, "tor: SAFECOOKIE authentication challenge successful\n");
|
||||
LogPrint(BCLog::TOR, "SAFECOOKIE authentication challenge successful\n");
|
||||
std::pair<std::string,std::string> l = SplitTorReplyLine(reply.lines[0]);
|
||||
if (l.first == "AUTHCHALLENGE") {
|
||||
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
||||
@@ -500,7 +500,7 @@ void TorController::authchallenge_cb(TorControlConnection& _conn, const TorContr
|
||||
}
|
||||
std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
|
||||
std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
|
||||
LogPrint(BCLog::TOR, "tor: AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
|
||||
LogPrint(BCLog::TOR, "AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
|
||||
if (serverNonce.size() != 32) {
|
||||
LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");
|
||||
return;
|
||||
@@ -547,12 +547,12 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
|
||||
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
||||
std::map<std::string,std::string>::iterator i;
|
||||
if ((i = m.find("Tor")) != m.end()) {
|
||||
LogPrint(BCLog::TOR, "tor: Connected to Tor version %s\n", i->second);
|
||||
LogPrint(BCLog::TOR, "Connected to Tor version %s\n", i->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const std::string &s : methods) {
|
||||
LogPrint(BCLog::TOR, "tor: Supported authentication method: %s\n", s);
|
||||
LogPrint(BCLog::TOR, "Supported authentication method: %s\n", s);
|
||||
}
|
||||
// Prefer NULL, otherwise SAFECOOKIE. If a password is provided, use HASHEDPASSWORD
|
||||
/* Authentication:
|
||||
@@ -562,18 +562,18 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
|
||||
std::string torpassword = gArgs.GetArg("-torpassword", "");
|
||||
if (!torpassword.empty()) {
|
||||
if (methods.count("HASHEDPASSWORD")) {
|
||||
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n");
|
||||
LogPrint(BCLog::TOR, "Using HASHEDPASSWORD authentication\n");
|
||||
ReplaceAll(torpassword, "\"", "\\\"");
|
||||
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||
} else {
|
||||
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
|
||||
}
|
||||
} else if (methods.count("NULL")) {
|
||||
LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
|
||||
LogPrint(BCLog::TOR, "Using NULL authentication\n");
|
||||
_conn.Command("AUTHENTICATE", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||
} else if (methods.count("SAFECOOKIE")) {
|
||||
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
|
||||
LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
||||
LogPrint(BCLog::TOR, "Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
||||
std::pair<bool,std::string> status_cookie = ReadBinaryFile(fs::PathFromString(cookiefile), TOR_COOKIE_SIZE);
|
||||
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
|
||||
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||
@@ -615,7 +615,7 @@ void TorController::disconnected_cb(TorControlConnection& _conn)
|
||||
if (!reconnect)
|
||||
return;
|
||||
|
||||
LogPrint(BCLog::TOR, "tor: Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
|
||||
LogPrint(BCLog::TOR, "Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
|
||||
|
||||
// Single-shot timer for reconnect. Use exponential backoff.
|
||||
struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0));
|
||||
|
||||
Reference in New Issue
Block a user