Skip to content

Commit

Permalink
replaced showip
Browse files Browse the repository at this point in the history
removed the no more existing showip.com with my own zettelkasten checkip subdomain.
  • Loading branch information
zettel-kasten committed Jun 3, 2021
1 parent b187ab0 commit 7332d6d
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,23 +350,19 @@ bool GetMyExternalIP(CNetAddr& ipRet)
const char* pszGet;
const char* pszKeyword;

for (int nLookup = 0; nLookup <= 1; nLookup++)
//for (int nLookup = 0; nLookup <= 1; nLookup++)
for (int nHost = 1; nHost <= 2; nHost++)
{
// We should be phasing out our use of sites like these. If we need
// replacements, we should ask for volunteers to put this simple
// php file on their web server that prints the client IP:
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>

if (nHost == 1)
{
addrConnect = CService("91.198.22.70", 80); // checkip.dyndns.org

if (nLookup == 1)
{
CService addrIP("checkip.dyndns.org", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;
}
CService addrIP("checkip.dyndns.org", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;

pszGet = "GET / HTTP/1.1\r\n"
"Host: checkip.dyndns.org\r\n"
Expand All @@ -376,24 +372,19 @@ bool GetMyExternalIP(CNetAddr& ipRet)

pszKeyword = "Address:";
}
else if (nHost == 2)
if (nHost == 2)
{
addrConnect = CService("74.208.43.192", 80); // www.showmyip.com

if (nLookup == 1)
{
CService addrIP("www.showmyip.com", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;
}
CService addrIP("checkip.zettelkasten.org", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;

pszGet = "GET /simple/ HTTP/1.1\r\n"
"Host: www.showmyip.com\r\n"
"Host: checkip.zettelkasten.org\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
"Connection: close\r\n"
"\r\n";

pszKeyword = NULL; // Returns just IP address
pszKeyword = "Address:";
}

if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
Expand Down

0 comments on commit 7332d6d

Please sign in to comment.