require './ssl.rb' require './http.rb' require './fake_tunnel_connector.rb' port = ARGV[0] if ARGV.count == 0 puts "Please provide a port for the server to listen on." exit end cert_path = './certificate.pem' key_path = './private_key.pem' # lib for easier ssl usage ssl_helper = SSL.new # load our self-signed certificate cert = ssl_helper.load_cert(cert_path) key = ssl_helper.load_key(key_path) # setup a new ssl context to be used with the tcp server context = ssl_helper.new_ssl_context(cert, key) # setup our server on the port that we pass into the script and listen for https calls. server = FakeTunnelConnector.new(port, ssl_context=context) loop { server.listen_and_respond }