mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-13 04:46: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) {
|
if(i2pcontrolPort) {
|
||||||
m_I2PControlService = new I2PControlService(
|
m_I2PControlService = new I2PControlService(
|
||||||
i2p::util::config::GetArg("-i2pcontroladdress", "127.0.0.1"),
|
i2p::util::config::GetArg("-i2pcontroladdress", "127.0.0.1"),
|
||||||
i2pcontrolPort
|
i2pcontrolPort,
|
||||||
|
i2p::util::config::GetArg("-i2pcontrolpassword", I2P_CONTROL_DEFAULT_PASSWORD)
|
||||||
);
|
);
|
||||||
m_I2PControlService->Start();
|
m_I2PControlService->Start();
|
||||||
LogPrint("I2PControl started");
|
LogPrint("I2PControl started");
|
||||||
|
|
|
@ -100,8 +100,8 @@ void I2PControlSession::Response::setId(const std::string& identifier)
|
||||||
id = identifier;
|
id = identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
I2PControlSession::I2PControlSession(boost::asio::io_service& ios)
|
I2PControlSession::I2PControlSession(boost::asio::io_service& ios, const std::string& pass)
|
||||||
: password(I2P_CONTROL_DEFAULT_PASSWORD), tokens(), tokensMutex(),
|
: password(pass), tokens(), tokensMutex(),
|
||||||
service(ios), shutdownTimer(ios), expireTokensTimer(ios)
|
service(ios), shutdownTimer(ios), expireTokensTimer(ios)
|
||||||
{
|
{
|
||||||
// Method handlers
|
// Method handlers
|
||||||
|
|
|
@ -108,10 +108,12 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the appropriate handlers.
|
* 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
|
* @param ios the parent io_service object, must remain valid throughout
|
||||||
* the lifetime of this I2PControlSession.
|
* 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.
|
* Starts the I2PControlSession.
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
#include "util/Timestamp.h"
|
#include "util/Timestamp.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p {
|
||||||
{
|
namespace client {
|
||||||
namespace client
|
I2PControlService::I2PControlService(const std::string& address, int port, const std::string& pass)
|
||||||
{
|
: m_Session(std::make_shared<I2PControlSession>(m_Service, pass)),
|
||||||
I2PControlService::I2PControlService(const std::string& address, int port)
|
|
||||||
: m_Session(std::make_shared<I2PControlSession>(m_Service)),
|
|
||||||
m_IsRunning(false), m_Thread(nullptr),
|
m_IsRunning(false), m_Thread(nullptr),
|
||||||
m_Acceptor(m_Service, boost::asio::ip::tcp::endpoint(
|
m_Acceptor(m_Service, boost::asio::ip::tcp::endpoint(
|
||||||
boost::asio::ip::address::from_string(address), port)
|
boost::asio::ip::address::from_string(address), port)
|
||||||
|
|
|
@ -21,7 +21,7 @@ typedef std::array<char, I2P_CONTROL_MAX_REQUEST_SIZE> I2PControlBuffer;
|
||||||
class I2PControlService {
|
class I2PControlService {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
I2PControlService(const std::string& address, int port);
|
I2PControlService(const std::string& address, int port, const std::string& pass);
|
||||||
~I2PControlService ();
|
~I2PControlService ();
|
||||||
|
|
||||||
void Start ();
|
void Start ();
|
||||||
|
|
Loading…
Add table
Reference in a new issue