Class: SocksTunnel::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/socks_tunnel/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.daemonObject

Returns the value of attribute daemon.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def daemon
  @daemon
end

.local_server_hostObject

Returns the value of attribute local_server_host.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def local_server_host
  @local_server_host
end

.local_server_portObject

Returns the value of attribute local_server_port.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def local_server_port
  @local_server_port
end

.passwordObject

Returns the value of attribute password.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def password
  @password
end

.remote_server_hostObject

Returns the value of attribute remote_server_host.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def remote_server_host
  @remote_server_host
end

.remote_server_portObject

Returns the value of attribute remote_server_port.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def remote_server_port
  @remote_server_port
end

.saltObject

Returns the value of attribute salt.



4
5
6
# File 'lib/socks_tunnel/config.rb', line 4

def salt
  @salt
end

Class Method Details

.cipherObject



32
33
34
# File 'lib/socks_tunnel/config.rb', line 32

def cipher
  @cipher ||= 'AES-256-CBC'
end

.daemon?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/socks_tunnel/config.rb', line 36

def daemon?
  !!@daemon
end

.delimiterObject



28
29
30
# File 'lib/socks_tunnel/config.rb', line 28

def delimiter
  @delimiter ||= '===SOCKSTUNNEL==='
end

.from(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/socks_tunnel/config.rb', line 7

def from(options)
  if options[:remote_addr]
    @local_server_port = options[:port]
    @local_server_host = options[:host] if options[:host]
    @remote_server_host, @remote_server_port = options[:remote_addr].split(':')
  else
    @remote_server_port = options[:port]
  end
  @password = options[:password]
  @salt = options[:salt] if options[:salt]
  @daemon = options[:daemon] if options[:daemon]
end