mirror of
https://git.hush.is/hush/hush3.git
synced 2025-07-06 00:01:55 -04:00
Compare commits
2 Commits
512da314a5
...
6f8bce9b3a
Author | SHA1 | Date | |
---|---|---|---|
|
6f8bce9b3a | ||
|
9d2277c697 |
@ -7,5 +7,6 @@
|
||||
# lite.hushpool.is
|
||||
149.28.102.219
|
||||
|
||||
# todo: torv3
|
||||
56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||
|
||||
# todo: i2p
|
||||
|
@ -12,6 +12,7 @@ static const uint8_t chainparams_seed_main[] = {
|
||||
0x01,0x04,0xb9,0xf1,0x3d,0x2b,0x00,0x00, // 185.241.61.43
|
||||
0x01,0x04,0x89,0x4a,0x04,0xc6,0x00,0x00, // 137.74.4.198
|
||||
0x01,0x04,0x95,0x1c,0x66,0xdb,0x00,0x00, // 149.28.102.219
|
||||
0x04,0x20,0xef,0xad,0x0c,0x95,0x3e,0x61,0xee,0x69,0x57,0x67,0xdb,0x4f,0xb7,0x8d,0xc2,0x35,0x1c,0x6b,0x96,0xf4,0x1f,0x7a,0xb4,0x06,0x09,0x3a,0x64,0x33,0xf4,0x0b,0x2c,0x94,0x00,0x00, // 56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||
};
|
||||
|
||||
static const uint8_t chainparams_seed_test[] = {
|
||||
|
24
src/net.cpp
24
src/net.cpp
@ -604,6 +604,7 @@ void DumpBanlist()
|
||||
if (bandb.Write(banmap)) {
|
||||
SetBannedSetDirty(false);
|
||||
}
|
||||
fprintf(stderr,"%s: Dumping banlist with %lu items\n", __func__, banmap.size());
|
||||
|
||||
LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
|
||||
banmap.size(), GetTimeMillis() - nStart);
|
||||
@ -617,7 +618,6 @@ void CNode::ClearBanned()
|
||||
setBannedIsDirty = true;
|
||||
}
|
||||
DumpBanlist(); //store banlist to disk
|
||||
// uiInterface.BannedListChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -631,8 +631,10 @@ bool CNode::IsBanned(CNetAddr ip)
|
||||
CSubNet subNet = (*it).first;
|
||||
CBanEntry banEntry = (*it).second;
|
||||
|
||||
if(subNet.Match(ip) && GetTime() < banEntry.nBanUntil)
|
||||
if(subNet.Match(ip) && GetTime() < banEntry.nBanUntil) {
|
||||
fprintf(stderr,"%s: found banned subnet %s\n", __func__, subNet.ToString().c_str());
|
||||
fResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return fResult;
|
||||
@ -664,25 +666,29 @@ void CNode::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t banti
|
||||
if (bantimeoffset > 0)
|
||||
banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset;
|
||||
|
||||
fprintf(stderr, "%s: banning %s until %ld with bantimeoffset=%ld sinceUnixEpoch=%d\n", __func__, subNet.ToString().c_str(), banEntry.nBanUntil, bantimeoffset, sinceUnixEpoch);
|
||||
{
|
||||
LOCK(cs_setBanned);
|
||||
if (setBanned[subNet].nBanUntil < banEntry.nBanUntil) {
|
||||
setBanned[subNet] = banEntry;
|
||||
setBannedIsDirty = true;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// uiInterface.BannedListChanged();
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
for (CNode* pnode : vNodes) {
|
||||
if (subNet.Match(static_cast<CNetAddr>(pnode->addr)))
|
||||
fprintf(stderr, "%s: disconnecting from banned node %s\n", __func__, pnode->addr.ToString().c_str() );
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
}
|
||||
if(banReason == BanReasonManuallyAdded)
|
||||
|
||||
if(banReason == BanReasonManuallyAdded) {
|
||||
fprintf(stderr,"%s: dumping banlist after manual ban\n", __func__);
|
||||
DumpBanlist(); //store banlist to disk immediately if user requested ban
|
||||
}
|
||||
}
|
||||
|
||||
bool CNode::Unban(const CNetAddr &addr) {
|
||||
@ -697,7 +703,6 @@ bool CNode::Unban(const CSubNet &subNet) {
|
||||
return false;
|
||||
setBannedIsDirty = true;
|
||||
}
|
||||
// uiInterface.BannedListChanged();
|
||||
DumpBanlist(); //store banlist to disk immediately
|
||||
return true;
|
||||
}
|
||||
@ -720,6 +725,7 @@ void SetBanned(const banmap_t &banMap)
|
||||
void SweepBanned()
|
||||
{
|
||||
int64_t now = GetTime();
|
||||
//fprintf(stderr,"%s: Sweeping banlist\n", __func__);
|
||||
|
||||
LOCK(cs_setBanned);
|
||||
banmap_t::iterator it = setBanned.begin();
|
||||
@ -732,9 +738,9 @@ void SweepBanned()
|
||||
setBanned.erase(it++);
|
||||
setBannedIsDirty = true;
|
||||
LogPrint("net", "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString());
|
||||
}
|
||||
else
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ UniValue setban(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if (isSubnet ? CNode::IsBanned(subNet) : CNode::IsBanned(netAddr))
|
||||
throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned");
|
||||
|
||||
int64_t banTime = 0; //use standard bantime if not specified
|
||||
int64_t banTime = 60*60*24; //use standard bantime if not specified
|
||||
if (params.size() >= 3 && !params[2].isNull())
|
||||
banTime = params[2].get_int64();
|
||||
|
||||
@ -641,14 +641,14 @@ UniValue setban(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if (params.size() == 4 && params[3].isTrue())
|
||||
absolute = true;
|
||||
|
||||
fprintf(stderr,"%s: adding manual ban for %s with banTime=%ld absolute=%d isSubnet=%d\n", __func__, isSubnet ? subNet.ToString().c_str() : netAddr.ToString().c_str(), banTime, absolute, isSubnet);
|
||||
isSubnet ? CNode::Ban(subNet, BanReasonManuallyAdded, banTime, absolute) : CNode::Ban(netAddr, BanReasonManuallyAdded, banTime, absolute);
|
||||
|
||||
//disconnect possible nodes
|
||||
while(CNode *bannedNode = (isSubnet ? FindNode(subNet) : FindNode(netAddr)))
|
||||
while(CNode *bannedNode = (isSubnet ? FindNode(subNet) : FindNode(netAddr))) {
|
||||
bannedNode->fDisconnect = true;
|
||||
}
|
||||
else if(strCommand == "remove")
|
||||
{
|
||||
}
|
||||
} else if(strCommand == "remove") {
|
||||
if (!( isSubnet ? CNode::Unban(subNet) : CNode::Unban(netAddr) ))
|
||||
throw JSONRPCError(RPC_MISC_ERROR, "Error: Unban failed");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user