update p3i2psam

This commit is contained in:
sehraf 2020-11-26 21:05:25 +01:00
parent 1fa16aa6eb
commit 36e238951f
No known key found for this signature in database
GPG Key ID: DF09F6EAE356B2C6

View File

@ -74,19 +74,26 @@ bool p3I2pSam3::initialSetup(std::string &addr, uint16_t &/*port*/)
} else { } else {
std::string s, c; std::string s, c;
i2p::getKeyTypes(mSetting.address.publicKey, s, c); i2p::getKeyTypes(mSetting.address.publicKey, s, c);
RS_INFO("received key", s, c); RS_INFO("received key ", s, " ", c);
RS_INFO("public key: ", mSetting.address.publicKey);
RS_INFO("private key: ", mSetting.address.privateKey);
RS_INFO("address: ", i2p::keyToBase32Addr(mSetting.address.publicKey));
// sanity check // sanity check
auto pub = i2p::publicKeyFromPrivate(mSetting.address.privateKey); auto pub = i2p::publicKeyFromPrivate(mSetting.address.privateKey);
RS_INFO("pub key derived: ", pub);
RS_INFO("address: ", i2p::keyToBase32Addr(pub));
if (pub != mSetting.address.publicKey) { if (pub != mSetting.address.publicKey) {
RS_WARN("public key does not match private key! fixing ..."); RS_WARN("public key does not match private key! fixing ...");
mSetting.address.privateKey = pub; mSetting.address.publicKey = pub;
} }
mSetting.address.base32 = i2p::keyToBase32Addr(mSetting.address.publicKey);
IndicateConfigChanged(); IndicateConfigChanged();
} }
addr = mSetting.address.base32 = i2p::keyToBase32Addr(mSetting.address.publicKey); addr = mSetting.address.base32;
return true; return true;
} }
@ -555,7 +562,6 @@ bool p3I2pSam3::startForwarding()
RS_STACK_MUTEX(mLockSam3Access); RS_STACK_MUTEX(mLockSam3Access);
int ret = sam3StreamForward(mSetting.session, sockaddr_storage_iptostring(ps.localaddr).c_str(), sockaddr_storage_port(ps.localaddr)); int ret = sam3StreamForward(mSetting.session, sockaddr_storage_iptostring(ps.localaddr).c_str(), sockaddr_storage_port(ps.localaddr));
if (ret < 0) { if (ret < 0) {
RS_DBG("forward failed, due to", mSetting.session->error); RS_DBG("forward failed, due to", mSetting.session->error);
return false; return false;