Method: Forward::Tunnel#initialize

Defined in:
lib/forward/tunnel.rb

#initialize(attributes = {}) ⇒ Tunnel

Initializes a Tunnel instance for the Client and requests a tunnel from API.

client - The Client instance.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/forward/tunnel.rb', line 36

def initialize(attributes = {})
  logger.debug "[tunnel] initializing with: #{attributes.inspect}"
  @attributes       = attributes
  @id               = attributes[:id]
  @host             = attributes[:vhost]
  @port             = attributes[:hostport]
  @subdomain_prefix = attributes[:subdomain_prefix]
  @username         = attributes[:username]
  @password         = attributes[:password]
  @no_auth          = attributes[:no_auth]
  @static_path      = attributes[:static_path]
  @cname            = attributes[:cname]
  @timeout          = attributes[:timeout]
  @tunneler         = attributes[:tunneler]
  @url              = attributes[:url]
  @requests         = {}
  @open             = false
  @socket           = Socket.new(self)
end