Created
December 20, 2010 23:02
-
-
Save ntalbott/749180 to your computer and use it in GitHub Desktop.
Automatically and temporarily exposes a little Rack server on your firewall for testing purposes. Requires UPnP to be enabled on your firewall to work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXTERNAL_PORT = 42063 | |
require 'UPnP' | |
upnp = UPnP::UPnP.new(true, 10) | |
upnp.addPortMapping(EXTERNAL_PORT, 9292, UPnP::Protocol::TCP, "Test Port") | |
at_exit{upnp.deletePortMapping(EXTERNAL_PORT, UPnP::Protocol::TCP)} | |
puts "Call externally: http://#{upnp.externalIP}:#{EXTERNAL_PORT}" | |
run proc{|env| p :env => env; [200, {"Content-Type" => "text/html"}, ["success\n"]]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment