mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-01-30 16:34:29 +00:00
correct addresses to detect own IP
This commit is contained in:
parent
976e640416
commit
11c6766095
47
src/net.cpp
47
src/net.cpp
@ -377,43 +377,36 @@ bool GetMyExternalIP(CNetAddr& ipRet)
|
|||||||
// replacements, we should ask for volunteers to put this simple
|
// replacements, we should ask for volunteers to put this simple
|
||||||
// php file on their web server that prints the client IP:
|
// php file on their web server that prints the client IP:
|
||||||
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
|
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
|
||||||
if (nHost == 1)
|
switch(nHost) {
|
||||||
{
|
case 1 :
|
||||||
addrConnect = CService("91.198.22.70", 80); // checkip.dyndns.org
|
addrConnect = CService("66.171.248.178", 80); // whatismyipaddress.com has a bot too
|
||||||
|
if (nLookup == 1) {
|
||||||
if (nLookup == 1)
|
CService addrIP("bot.whatismyipaddress.com", 80, true);
|
||||||
{
|
if (addrIP.IsValid())
|
||||||
|
addrConnect = addrIP;
|
||||||
|
}
|
||||||
|
pszGet = "GET / HTTP/1.1\r\n"
|
||||||
|
"Host: bot.whatismyipaddress.com\r\n"
|
||||||
|
"User-Agent: Mozilla/4.0\r\n"
|
||||||
|
"Connection: close\r\n"
|
||||||
|
"\r\n";
|
||||||
|
pszKeyword = NULL;
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
addrConnect = CService("216.146.43.71", 80); // checkip.dyndns.org
|
||||||
|
if (nLookup == 1) {
|
||||||
CService addrIP("checkip.dyndns.org", 80, true);
|
CService addrIP("checkip.dyndns.org", 80, true);
|
||||||
if (addrIP.IsValid())
|
if (addrIP.IsValid())
|
||||||
addrConnect = addrIP;
|
addrConnect = addrIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
pszGet = "GET / HTTP/1.1\r\n"
|
pszGet = "GET / HTTP/1.1\r\n"
|
||||||
"Host: checkip.dyndns.org\r\n"
|
"Host: checkip.dyndns.org\r\n"
|
||||||
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
|
"User-Agent: Mozilla/4.0\r\n"
|
||||||
"Connection: close\r\n"
|
"Connection: close\r\n"
|
||||||
"\r\n";
|
"\r\n";
|
||||||
|
|
||||||
pszKeyword = "Address:";
|
pszKeyword = "Address:";
|
||||||
}
|
break;
|
||||||
else 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
pszGet = "GET /simple/ HTTP/1.1\r\n"
|
|
||||||
"Host: www.showmyip.com\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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
|
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user