[Bitcoin-development] External IP Address

Sam Michaels sam at samtheham.org
Sun Mar 16 07:04:13 UTC 2014


Hello devs.

I was poking around in the code for a small project and I came across the
function GetMyExternalIP() in net.cpp.  The comment says you'd like to
phase out the current method.

I threw together exactly what was asked in the comments: it's a site that
has PHP echo the IP address.  Additionally, it captures the IP, user agent,
and time for analysis (a client with the same IP and user agent just
updates the entry).

The site for the client is: ip.bitcheck.us.  It does a quick search for
"Mozilla" in the user agent to redirect browers that go there.

The following information is sent:

---
GET / HTTP/1.1
Host: ip.bitcheck.us
User-Agent: /Satoshi:0.8.6/
Connection: close
---

And following is received:

---
HTTP/1.1 200 OK
Date: Sun, 16 Mar 2014 05:31:51 GMT
Server: Apache mod_fcgid/2.3.10-dev
X-Powered-By: Satoshi v1.0
X-Client-Update: yes
Content-Length: 9
Connection: close
Content-Type: text/html

127.0.0.1
---

You can look for X-Client-Update to see if the check in was logged.  Other
information can be passed in the header, too.

Errors are trapped so that it will always display the IP address and any
error information is contained in the headers.

Hope you find this useful.

Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140316/8acf5218/attachment.html>


More information about the bitcoin-dev mailing list