Class: RSocks::Config
- Inherits:
-
Object
- Object
- RSocks::Config
- Defined in:
- lib/r_socks/config.rb
Instance Method Summary collapse
- #auth_adaptor ⇒ Object
- #auth_adaptor=(adaptor) ⇒ Object
- #auth_method ⇒ Object
- #auth_method=(method) ⇒ Object
- #enable_ssl=(value) ⇒ Object
- #enable_ssl? ⇒ Boolean
- #forward_addr ⇒ Object
- #forward_addr=(value) ⇒ Object
- #forward_port ⇒ Object
- #forward_port=(value) ⇒ Object
- #forward_server=(value) ⇒ Object
- #forward_server? ⇒ Boolean
- #forward_white_list ⇒ Object
- #forward_white_list=(arr) ⇒ Object
- #health_check_route ⇒ Object
- #health_check_route=(str) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #instances ⇒ Object
- #instances=(number) ⇒ Object
- #proxy_buffer_size ⇒ Object
- #proxy_buffer_size=(value) ⇒ Object
- #proxy_type ⇒ Object
- #proxy_type=(type) ⇒ Object
- #ssl_cert ⇒ Object
- #ssl_cert=(value) ⇒ Object
- #ssl_private_key ⇒ Object
- #ssl_private_key=(value) ⇒ Object
- #unbind_handler ⇒ Object
- #unbind_handler=(obj) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
3 4 5 |
# File 'lib/r_socks/config.rb', line 3 def initialize @store = {} end |
Instance Method Details
#auth_adaptor ⇒ Object
11 12 13 |
# File 'lib/r_socks/config.rb', line 11 def auth_adaptor @store[:adaptor] end |
#auth_adaptor=(adaptor) ⇒ Object
7 8 9 |
# File 'lib/r_socks/config.rb', line 7 def auth_adaptor=(adaptor) @store[:adaptor] = adaptor end |
#auth_method ⇒ Object
25 26 27 |
# File 'lib/r_socks/config.rb', line 25 def auth_method @store[:auth_method] || :password end |
#auth_method=(method) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/r_socks/config.rb', line 15 def auth_method=(method) if method == :no_auth @store[:auth_method] = :no_auth elsif method == :password @store[:auth_method] = :password else raise Error, "unknown auth method #{method}" end end |
#enable_ssl=(value) ⇒ Object
74 75 76 |
# File 'lib/r_socks/config.rb', line 74 def enable_ssl=(value) @store[:enable_ssl] = value end |
#enable_ssl? ⇒ Boolean
78 79 80 |
# File 'lib/r_socks/config.rb', line 78 def enable_ssl? !!@store[:enable_ssl] end |
#forward_addr ⇒ Object
110 111 112 |
# File 'lib/r_socks/config.rb', line 110 def forward_addr @store[:forward_addr] end |
#forward_addr=(value) ⇒ Object
118 119 120 |
# File 'lib/r_socks/config.rb', line 118 def forward_addr=(value) @store[:forward_addr] = value.to_s end |
#forward_port ⇒ Object
106 107 108 |
# File 'lib/r_socks/config.rb', line 106 def forward_port @store[:forward_port] end |
#forward_port=(value) ⇒ Object
114 115 116 |
# File 'lib/r_socks/config.rb', line 114 def forward_port=(value) @store[:forward_port] = value.to_i end |
#forward_server=(value) ⇒ Object
102 103 104 |
# File 'lib/r_socks/config.rb', line 102 def forward_server=(value) @store[:forward_server] = value end |
#forward_server? ⇒ Boolean
98 99 100 |
# File 'lib/r_socks/config.rb', line 98 def forward_server? @store[:forward_server] || false end |
#forward_white_list ⇒ Object
126 127 128 |
# File 'lib/r_socks/config.rb', line 126 def forward_white_list @store[:white_list] || [] end |
#forward_white_list=(arr) ⇒ Object
122 123 124 |
# File 'lib/r_socks/config.rb', line 122 def forward_white_list=(arr) @store[:white_list] = arr end |
#health_check_route ⇒ Object
54 55 56 |
# File 'lib/r_socks/config.rb', line 54 def health_check_route @store[:health_check_route] || '/health' end |
#health_check_route=(str) ⇒ Object
50 51 52 |
# File 'lib/r_socks/config.rb', line 50 def health_check_route=(str) @store[:health_check_route] = str; end |
#instances ⇒ Object
86 87 88 |
# File 'lib/r_socks/config.rb', line 86 def instances @store[:instance] || 1 end |
#instances=(number) ⇒ Object
82 83 84 |
# File 'lib/r_socks/config.rb', line 82 def instances=(number) @store[:instance] = number end |
#proxy_buffer_size ⇒ Object
42 43 44 |
# File 'lib/r_socks/config.rb', line 42 def proxy_buffer_size @store[:proxy_buffer_size] || 1024 * 1024 * 10 end |
#proxy_buffer_size=(value) ⇒ Object
46 47 48 |
# File 'lib/r_socks/config.rb', line 46 def proxy_buffer_size=(value) @store[:proxy_buffer_size] = value.to_i end |
#proxy_type ⇒ Object
38 39 40 |
# File 'lib/r_socks/config.rb', line 38 def proxy_type @store[:proxy_type] || :socks5 end |
#proxy_type=(type) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/r_socks/config.rb', line 29 def proxy_type=(type) if type == :http @store[:proxy_type] = :http elsif type == :socks5 @store[:proxy_type] = :socks5 end end |
#ssl_cert ⇒ Object
70 71 72 |
# File 'lib/r_socks/config.rb', line 70 def ssl_cert @store[:ssl_cert] end |
#ssl_cert=(value) ⇒ Object
66 67 68 |
# File 'lib/r_socks/config.rb', line 66 def ssl_cert=(value) @store[:ssl_cert] = value end |
#ssl_private_key ⇒ Object
62 63 64 |
# File 'lib/r_socks/config.rb', line 62 def ssl_private_key @store[:ssl_private_key] end |
#ssl_private_key=(value) ⇒ Object
58 59 60 |
# File 'lib/r_socks/config.rb', line 58 def ssl_private_key=(value) @store[:ssl_private_key] = value end |
#unbind_handler ⇒ Object
94 95 96 |
# File 'lib/r_socks/config.rb', line 94 def unbind_handler @store[:unbind_handler] end |
#unbind_handler=(obj) ⇒ Object
90 91 92 |
# File 'lib/r_socks/config.rb', line 90 def unbind_handler=(obj) @store[:unbind_handler] = obj end |