mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-12 20:36:38 +01:00
Make i2pcontrol password configurable.
This commit is contained in:
parent
8434863beb
commit
843abb60dd
5 changed files with 12 additions and 11 deletions
|
@ -116,7 +116,8 @@ namespace client
|
|||
if(i2pcontrolPort) {
|
||||
m_I2PControlService = new I2PControlService(
|
||||
i2p::util::config::GetArg("-i2pcontroladdress", "127.0.0.1"),
|
||||
i2pcontrolPort
|
||||
i2pcontrolPort,
|
||||
i2p::util::config::GetArg("-i2pcontrolpassword", I2P_CONTROL_DEFAULT_PASSWORD)
|
||||
);
|
||||
m_I2PControlService->Start();
|
||||
LogPrint("I2PControl started");
|
||||
|
|
|
@ -100,8 +100,8 @@ void I2PControlSession::Response::setId(const std::string& identifier)
|
|||
id = identifier;
|
||||
}
|
||||
|
||||
I2PControlSession::I2PControlSession(boost::asio::io_service& ios)
|
||||
: password(I2P_CONTROL_DEFAULT_PASSWORD), tokens(), tokensMutex(),
|
||||
I2PControlSession::I2PControlSession(boost::asio::io_service& ios, const std::string& pass)
|
||||
: password(pass), tokens(), tokensMutex(),
|
||||
service(ios), shutdownTimer(ios), expireTokensTimer(ios)
|
||||
{
|
||||
// Method handlers
|
||||
|
|
|
@ -108,10 +108,12 @@ public:
|
|||
|
||||
/**
|
||||
* Sets up the appropriate handlers.
|
||||
* @param pass the password required to authenticate (i.e. obtains a token)
|
||||
* @param ios the parent io_service object, must remain valid throughout
|
||||
* the lifetime of this I2PControlSession.
|
||||
*/
|
||||
I2PControlSession(boost::asio::io_service& ios);
|
||||
I2PControlSession(boost::asio::io_service& ios,
|
||||
const std::string& pass = I2P_CONTROL_DEFAULT_PASSWORD);
|
||||
|
||||
/**
|
||||
* Starts the I2PControlSession.
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
#include "util/Timestamp.h"
|
||||
#include "version.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace client
|
||||
{
|
||||
I2PControlService::I2PControlService(const std::string& address, int port)
|
||||
: m_Session(std::make_shared<I2PControlSession>(m_Service)),
|
||||
namespace i2p {
|
||||
namespace client {
|
||||
I2PControlService::I2PControlService(const std::string& address, int port, const std::string& pass)
|
||||
: m_Session(std::make_shared<I2PControlSession>(m_Service, pass)),
|
||||
m_IsRunning(false), m_Thread(nullptr),
|
||||
m_Acceptor(m_Service, boost::asio::ip::tcp::endpoint(
|
||||
boost::asio::ip::address::from_string(address), port)
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef std::array<char, I2P_CONTROL_MAX_REQUEST_SIZE> I2PControlBuffer;
|
|||
class I2PControlService {
|
||||
public:
|
||||
|
||||
I2PControlService(const std::string& address, int port);
|
||||
I2PControlService(const std::string& address, int port, const std::string& pass);
|
||||
~I2PControlService ();
|
||||
|
||||
void Start ();
|
||||
|
|
Loading…
Add table
Reference in a new issue