Class: Ritm::Proxy::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ritm/proxy/launcher.rb

Overview

Launches the Proxy server and the SSL Reverse Proxy with the given settings

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Launcher

By default settings are read from Ritm::Configuration but you can override some via these named arguments:

proxy_port [Fixnum]: the port where the main proxy listens (the one to be configured in the client)
ssl_reverse_proxy_port [Fixnum]: the port where the reverse proxy for ssl traffic interception listens
interface [String]: the host/address to bind the main proxy
ca_crt_path [String]: the path to the certification authority certificate
ca_key_path [String]: the path to the certification authority private key
request_interceptor [Proc |request|]: the handler for request interception
response_interceptor [Proc |request, response|]: the handler for response interception


18
19
20
21
22
23
# File 'lib/ritm/proxy/launcher.rb', line 18

def initialize(**args)
  build_settings(**args)

  build_reverse_proxy(@ssl_proxy_host, @ssl_proxy_port, @request_interceptor, @response_interceptor)
  build_proxy(@proxy_host, @proxy_port, @https_forward, @request_interceptor, @response_interceptor)
end

Instance Method Details

#shutdownObject

Stops the service



32
33
34
35
# File 'lib/ritm/proxy/launcher.rb', line 32

def shutdown
  @https.shutdown
  @http.shutdown
end

#startObject

Starts the service (non blocking)



26
27
28
29
# File 'lib/ritm/proxy/launcher.rb', line 26

def start
  @https.start_async
  @http.start_async
end