Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <boost/test/unit_test.hpp>
#include <map>
#include <string>
#include <utility>
Go to the source code of this file.
Functions | |
std::pair< std::string, std::string > | SplitTorReplyLine (const std::string &s) |
std::map< std::string, std::string > | ParseTorReplyMapping (const std::string &s) |
Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'. More... | |
static void | CheckSplitTorReplyLine (std::string input, std::string command, std::string args) |
BOOST_AUTO_TEST_CASE (util_SplitTorReplyLine) | |
static void | CheckParseTorReplyMapping (std::string input, std::map< std::string, std::string > expected) |
BOOST_AUTO_TEST_CASE (util_ParseTorReplyMapping) | |
BOOST_AUTO_TEST_CASE | ( | util_ParseTorReplyMapping | ) |
BOOST_AUTO_TEST_CASE | ( | util_SplitTorReplyLine | ) |
|
static |
Definition at line 59 of file torcontrol_tests.cpp.
|
static |
Definition at line 19 of file torcontrol_tests.cpp.
std::map< std::string, std::string > ParseTorReplyMapping | ( | const std::string & | s | ) |
Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.
Returns a map of keys to values, or an empty map if there was an error. Grammar is implicitly defined in https://spec.torproject.org/control-spec by the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24), and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
Unescape value. Per https://spec.torproject.org/control-spec section 2.1.1:
For future-proofing, controller implementers MAY use the following rules to be compatible with buggy Tor implementations and with future ones that implement the spec as intended:
Read
\t \r and \0 ... \377 as C escapes. Treat a backslash followed by any other character as that character.
Definition at line 228 of file torcontrol.cpp.
std::pair< std::string, std::string > SplitTorReplyLine | ( | const std::string & | s | ) |