Created
February 5, 2014 07:23
-
-
Save ljfauscett/8818770 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'webrick' | |
PORT = 7999 | |
server = WEBrick::HTTPServer.new( | |
Port: PORT, | |
BindAddress: '0.0.0.0', | |
Logger: WEBrick::Log.new('/dev/null') | |
) | |
server.mount_proc '/' do |req, res| | |
res.body = 'Hello, forward!' | |
end | |
%w[INT TERM].each do |signal| | |
trap(signal) { server.shutdown } | |
end | |
puts "\033[32mServer started on port #{PORT}, run `forward #{PORT}' in another terminal window to start a tunnel.\033[0m" | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment