indexpost archiveatom feed

Yet another IP lookup service

2022-08-05

It's yet another IP lookup service.

But contrast to the most, it's quite simple.

Here's the source code :)

package main

import (
	"net/http"
	"os"
)

func main() {
	if len(os.Args) != 2 {
		return
	}
	http.ListenAndServe(os.Args[1], http.HandlerFunc(
		func(w http.ResponseWriter, req *http.Request) {
			w.Write([]byte(req.Header.Get("X-Real-IP") + "\n"))
		},
	))
}

You can use it to look up your own IP address by:

curl ip.ookami.one