I decided that I need a simple service that tells me what IP I am currently using (e.g. to check if a VPN connection is working)

—> http://ip.marc-seeger.de

It's only a simple Rackup file (config.ru):

1
2
3
4
5
6
7
require "rubygems"

rack_app = Proc.new do |env|
[200, {"Content-Type" =>"text/html"}, env["REMOTE_ADDR"]]
end

run rack_app

Basically, Rack requires something that responds to a "call";-method. Luckily, Proc does. So I'm simply putting the REMOTE_ADDR field of the HTTP request in the generated answer :)

Comments