You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Daniel Carrillo ed0ddccab5
Update (CVE-2022-32149)
3 weeks ago
.github/workflows Update to golang 1.19 4 months ago
cmd Moving secure again, this time to 7 months ago
integration-tests Update to golang 1.19 4 months ago
internal Remove headers set by a trusted proxy from outputs 7 months ago
models Tidy up the house 10 months ago
router Use gin-gonic/contrib/secure instead of deprecated module 7 months ago
service Add CI and go-report badges. Add comments to make golint happy 1 year ago
test first commit 1 year ago
Dockerfile Update to golang 1.19 4 months ago
LICENSE Fix LICENSE file, a tgz instead of text plain was commited by mistake 1 year ago
Makefile Add feature to get the right client port when using a trusted proxy 7 months ago Update 5 months ago
go.mod Update (CVE-2022-32149) 3 weeks ago
go.sum Update (CVE-2022-32149) 3 weeks ago

What is my IP address

CI CodeQL Go Report Card GitHub release License Apache 2.0

Just another "what is my IP address" service, including geolocation and headers information, written in go with high performance in mind, it uses gin which uses httprouter a lightweight high performance HTTP multiplexer.

Take a look at a live site using whatismyip

Get your public IP easily from the command line:


curl -6


  • TLS and HTTP/2.
  • Can run behind a proxy by trusting a custom header (usually X-Real-IP) to figure out the source IP address. It also supports a custom header to resolve the client port, if the proxy can only add a header for the IP (for example a fixed header from CDNs) the client port is shown as unknown.
  • IPv4 and IPv6.
  • Geolocation info including ASN. This feature is possible thanks to maxmind GeoLite2 databases. In order to use these databases, a license key is needed. Please visit Maxmind site for further instructions and get a free license.
  • High performance.
  • Self-contained server what can reload GeoLite2 databases and/or SSL certificates without stop/start. The hup signal is honored.
  • HTML templates for the landing page.
  • Text plain and JSON output.



Golang >= 1.17 is required. Previous versions may work.

make build


Usage of whatismyip:
  -bind string
        Listening address (see (default ":8080")
        Add sane security-related headers to every response
  -geoip2-asn string
        Path to GeoIP2 ASN database
  -geoip2-city string
        Path to GeoIP2 city database
  -template string
        Path to template file
  -tls-bind string
        Listening address for TLS (see
  -tls-crt string
        When using TLS, path to certificate file
  -tls-key string
        When using TLS, path to private key file
  -trusted-header string
        Trusted request header for remote IP (e.g. X-Real-IP). When using this feature if -trusted-port-header is not set the client port is shown as 'unknown'
  -trusted-port-header string
        Trusted request header for remote client port (e.g. X-Real-Port). When this parameter is set -trusted-header becomes mandatory
        Output version information and exit


Run a default TCP server

./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb

Run a TLS (HTTP/2) server only

./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb \
             -bind "" -tls-bind :8081 -tls-crt ./test/server.pem -tls-key ./test/server.key

Run a default TCP server with a custom template and trust a pair of custom headers set by an upstream proxy

./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb \
             -trusted-header X-Real-IP -trusted-port-header X-Real-Port -template mytemplate.tmpl


Download latest version from


An ultra-light (~10MB) image is available at docker hub.

Run a container locally using test databases

make docker-run

From Docker Hub

docker run --tty --interactive --rm \
    -v $PWD/<path to city database>:/tmp/GeoIP2-City-Test.mmdb:ro \
    -v $PWD/<path to ASN database>:/tmp/GeoLite2-ASN-Test.mmdb:ro -p 8080:8080 \
    dcarrillo/whatismyip:latest \
      -geoip2-city /tmp/GeoIP2-City-Test.mmdb \
      -geoip2-asn /tmp/GeoLite2-ASN-Test.mmdb