Return the IP address of the HTTP client
  • Go 93%
  • Dockerfile 7%
Find a file
Stefan Bethke dbc40caa45
All checks were successful
docker-image / docker (push) Successful in 2m44s
Use correct header
2026-03-08 17:03:02 +01:00
.forgejo/workflows Use local checkout 2026-03-08 12:59:08 +01:00
.gitignore Simple service to return the IP of HTTP client 2026-03-08 12:45:28 +01:00
Dockerfile Use compat to enable dynamically linked go binary 2026-03-08 14:50:59 +01:00
go.mod Simple service to return the IP of HTTP client 2026-03-08 12:45:28 +01:00
main.go Use correct header 2026-03-08 17:03:02 +01:00
README.md Simple service to return the IP of HTTP client 2026-03-08 12:45:28 +01:00

IP -- Return IP address of HTTP client

This simple server will return the IPv4 or IPv6 address of the HTTP client that has connected.

The server is listening on port 8080.

There are no configuration options.

Query the IP address the client is connecting from

Example:

$ curl localhost:8080
::1

The output is suitable for use in scripts with curl or wget.

Querying additional details

When requesting /details (or any other pat), in addition the reverse DNS and whois information for the address is shown.

Example:

~$ curl localhost:8080/details
::1

### DNS
localhost

### Whois
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object

inet6num:     0:0:0:0:0:0:0:0/8
descr:        Reserved by IETF

remarks:      http://tools.ietf.org/html/rfc3513
remarks:      http://tools.ietf.org/html/rfc4291

source:       IANA

The whois output relies on a command line whois client to be available on the path. The container image installs Alpines whois package for that. If the command is not available, the section will be ignored.