Class: T2Server::ConnectionParameters

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/t2-server/net/parameters.rb

Overview

This is the base class for holding parameters for network connections. It delegates most work to the underlying Hash in which options are actually stored.

The parameters that can be set are:

  • :ca_file - A file with the correct CA chain to verify the remote server.

  • :ca_path - A directory containing the CA files for server verification.

  • :verify_peer - Use peer verification? (true or false).

  • :client_certificate - File with the client’s certificate and private key.

  • :client_password - The password to unlock the client’s private key.

  • :ssl_version - The TLS/SSL version to use (:TLSv1, :SSLv23 or :SSLv3).

  • :open_timeout - The number of seconds to wait while opening a connection.

  • :read_timeout - The number of seconds to wait while reading from a connection.

All others will be ignored. Any parameters not set will return nil when queried.

Constant Summary collapse

ALLOWED_PARAMS =

:stopdoc:

[
  :ca_file,
  :ca_path,
  :verify_peer,
  :client_certificate,
  :client_password,
  :ssl_version,
  :open_timeout,
  :read_timeout
]

Instance Method Summary collapse

Constructor Details

#initializeConnectionParameters

Create a new set of connection parameters with no defaults set.



70
71
72
# File 'lib/t2-server/net/parameters.rb', line 70

def initialize
  @params = {}
end

Instance Method Details

#[]=(param, value) ⇒ Object

:call-seq:

[param] = value -> value

Set a connection parameter. See the list of allowed parameters in the class description.



79
80
81
# File 'lib/t2-server/net/parameters.rb', line 79

def []=(param, value)
  @params[param] = value if ALLOWED_PARAMS.include?(param)
end