Class: TunnelClient::TunnelListener

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/lds-cf-plugin/tunnel/tunnelclient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, tunnel_server_host, tunnel_server_port, app_guid, instance_id, port, use_tls) ⇒ TunnelListener

Returns a new instance of TunnelListener.



24
25
26
27
28
29
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 24

def initialize(token, tunnel_server_host, tunnel_server_port, app_guid, instance_id, port, use_tls)
  @token, @app_guid, @instance_id, @port, @use_tls = token, app_guid, instance_id, port, use_tls

  @tunnel_server_host = tunnel_server_host
  @tunnel_server_port = tunnel_server_port
end

Instance Attribute Details

#app_guidObject (readonly)

Returns the value of attribute app_guid.



19
20
21
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 19

def app_guid
  @app_guid
end

#instance_idObject (readonly)

Returns the value of attribute instance_id.



20
21
22
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 20

def instance_id
  @instance_id
end

#portObject (readonly)

Returns the value of attribute port.



21
22
23
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 21

def port
  @port
end

#tokenObject (readonly)

Returns the value of attribute token.



18
19
20
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 18

def token
  @token
end

#use_tlsObject (readonly)

Returns the value of attribute use_tls.



22
23
24
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 22

def use_tls
  @use_tls
end

Instance Method Details

#post_initObject



31
32
33
34
35
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 31

def post_init
  puts "Forwarding connection to server..."
  pause
  @connection = EventMachine.connect(@tunnel_server_host, @tunnel_server_port, TunnelConnection, self)
end

#unbindObject



37
38
39
40
# File 'lib/lds-cf-plugin/tunnel/tunnelclient.rb', line 37

def unbind
  puts "Connection closed"
  @connection.close_connection_after_writing
end