aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-10-11 00:41:33 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2012-10-11 00:41:33 -0700
commit24694e24ed6085d2184b396b9e8f717cc56754c3 (patch)
tree12971ce715d8de6bd38cb7a51688ce85fc7ca921 /src/netbase.cpp
parentfae3989ffc5102af00a932fcf72b5be1e8566912 (diff)
parent4e882b79605e15297f7c5411bfd5f3dce4cad6f1 (diff)
Merge pull request #1913 from sipa/noi2p
Remove I2P support from netbase
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index dbf79ab3e0..7b28e7f1bc 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -30,7 +30,6 @@ enum Network ParseNetwork(std::string net) {
if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6;
if (net == "tor") return NET_TOR;
- if (net == "i2p") return NET_I2P;
return NET_UNROUTABLE;
}
@@ -555,7 +554,6 @@ void CNetAddr::SetIP(const CNetAddr& ipIn)
}
static const unsigned char pchOnionCat[] = {0xFD,0x87,0xD8,0x7E,0xEB,0x43};
-static const unsigned char pchGarliCat[] = {0xFD,0x60,0xDB,0x4D,0xDD,0xB5};
bool CNetAddr::SetSpecial(const std::string &strName)
{
@@ -568,15 +566,6 @@ bool CNetAddr::SetSpecial(const std::string &strName)
ip[i + sizeof(pchOnionCat)] = vchAddr[i];
return true;
}
- if (strName.size()>11 && strName.substr(strName.size() - 11, 11) == ".oc.b32.i2p") {
- std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 11).c_str());
- if (vchAddr.size() != 16-sizeof(pchGarliCat))
- return false;
- memcpy(ip, pchOnionCat, sizeof(pchGarliCat));
- for (unsigned int i=0; i<16-sizeof(pchGarliCat); i++)
- ip[i + sizeof(pchGarliCat)] = vchAddr[i];
- return true;
- }
return false;
}
@@ -626,7 +615,7 @@ bool CNetAddr::IsIPv4() const
bool CNetAddr::IsIPv6() const
{
- return (!IsIPv4() && !IsTor() && !IsI2P());
+ return (!IsIPv4() && !IsTor());
}
bool CNetAddr::IsRFC1918() const
@@ -690,11 +679,6 @@ bool CNetAddr::IsTor() const
return (memcmp(ip, pchOnionCat, sizeof(pchOnionCat)) == 0);
}
-bool CNetAddr::IsI2P() const
-{
- return (memcmp(ip, pchGarliCat, sizeof(pchGarliCat)) == 0);
-}
-
bool CNetAddr::IsLocal() const
{
// IPv4 loopback
@@ -753,7 +737,7 @@ bool CNetAddr::IsValid() const
bool CNetAddr::IsRoutable() const
{
- return IsValid() && !(IsRFC1918() || IsRFC3927() || IsRFC4862() || (IsRFC4193() && !IsTor() && !IsI2P()) || IsRFC4843() || IsLocal());
+ return IsValid() && !(IsRFC1918() || IsRFC3927() || IsRFC4862() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal());
}
enum Network CNetAddr::GetNetwork() const
@@ -767,9 +751,6 @@ enum Network CNetAddr::GetNetwork() const
if (IsTor())
return NET_TOR;
- if (IsI2P())
- return NET_I2P;
-
return NET_IPV6;
}
@@ -777,8 +758,6 @@ std::string CNetAddr::ToStringIP() const
{
if (IsTor())
return EncodeBase32(&ip[6], 10) + ".onion";
- if (IsI2P())
- return EncodeBase32(&ip[6], 10) + ".oc.b32.i2p";
CService serv(*this, 0);
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
@@ -886,12 +865,6 @@ std::vector<unsigned char> CNetAddr::GetGroup() const
nStartByte = 6;
nBits = 4;
}
- else if (IsI2P())
- {
- nClass = NET_I2P;
- nStartByte = 6;
- nBits = 4;
- }
// for he.net, use /36 groups
else if (GetByte(15) == 0x20 && GetByte(14) == 0x11 && GetByte(13) == 0x04 && GetByte(12) == 0x70)
nBits = 36;
@@ -977,11 +950,6 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
case NET_IPV4: return REACH_IPV4; // Tor users can connect to IPv4 as well
case NET_TOR: return REACH_PRIVATE;
}
- case NET_I2P:
- switch(ourNet) {
- default: return REACH_DEFAULT;
- case NET_I2P: return REACH_PRIVATE;
- }
case NET_TEREDO:
switch(ourNet) {
default: return REACH_DEFAULT;
@@ -997,8 +965,7 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
case NET_TEREDO: return REACH_TEREDO;
case NET_IPV6: return REACH_IPV6_WEAK;
case NET_IPV4: return REACH_IPV4;
- case NET_I2P: return REACH_PRIVATE; // assume connections from unroutable addresses are
- case NET_TOR: return REACH_PRIVATE; // either from Tor/I2P, or don't care about our address
+ case NET_TOR: return REACH_PRIVATE; // either from Tor, or don't care about our address
}
}
}
@@ -1155,7 +1122,7 @@ std::string CService::ToStringPort() const
std::string CService::ToStringIPPort() const
{
- if (IsIPv4() || IsTor() || IsI2P()) {
+ if (IsIPv4() || IsTor()) {
return ToStringIP() + ":" + ToStringPort();
} else {
return "[" + ToStringIP() + "]:" + ToStringPort();