Class: ReverseTunnel::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/reverse-tunnel/server.rb

Defined Under Namespace

Classes: ApiServer, LocalConnection, Tunnel, TunnelConnection, Tunnels

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_hostObject

Returns the value of attribute api_host.



388
389
390
# File 'lib/reverse-tunnel/server.rb', line 388

def api_host
  @api_host
end

#api_portObject

Returns the value of attribute api_port.



388
389
390
# File 'lib/reverse-tunnel/server.rb', line 388

def api_port
  @api_port
end

#server_hostObject

Returns the value of attribute server_host.



373
374
375
# File 'lib/reverse-tunnel/server.rb', line 373

def server_host
  @server_host
end

#server_portObject

Returns the value of attribute server_port.



373
374
375
# File 'lib/reverse-tunnel/server.rb', line 373

def server_port
  @server_port
end

Instance Method Details

#local_host=(local_host) ⇒ Object



297
298
299
# File 'lib/reverse-tunnel/server.rb', line 297

def local_host=(local_host)
  tunnels.local_host = local_host
end

#local_port_range=(local_port_range) ⇒ Object



301
302
303
# File 'lib/reverse-tunnel/server.rb', line 301

def local_port_range=(local_port_range)
  tunnels.local_port_range = local_port_range
end

#startObject



366
367
368
369
370
371
# File 'lib/reverse-tunnel/server.rb', line 366

def start
  EventMachine.run do
    start_server
    start_api
  end
end

#start_apiObject



398
399
400
401
# File 'lib/reverse-tunnel/server.rb', line 398

def start_api
  ReverseTunnel.logger.info "Wait api requests #{api_host}:#{api_port}"
  EventMachine.start_server api_host, api_port, ApiServer, self
end

#start_serverObject



383
384
385
386
# File 'lib/reverse-tunnel/server.rb', line 383

def start_server
  ReverseTunnel.logger.info "Wait tunnel connections on #{server_host}:#{server_port}"
  EventMachine.start_server server_host, server_port, TunnelConnection, self
end

#tunnelsObject



293
294
295
# File 'lib/reverse-tunnel/server.rb', line 293

def tunnels
  @tunnels ||= Tunnels.new
end