Class: Riak::Client::BeefcakeProtobuffsBackend::BeefcakeSocket::TlsInitiator Private

Inherits:
Object
  • Object
show all
Includes:
Util::Translation
Defined in:
lib/riak/client/beefcake/socket.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wrap up the logic to turn a TCP socket into a TLS socket. Depends on Beefcake, which should be relatively safe.

Constant Summary collapse

BC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

::Riak::Client::BeefcakeProtobuffsBackend

Instance Method Summary collapse

Methods included from Util::Translation

#i18n_scope, #t

Constructor Details

#initialize(tcp_socket, host, authentication) ⇒ TlsInitiator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a TLS Initiator

Parameters:

  • tcp_socket (TCPSocket)

    the TCPSocket to start TLS on

  • authentication (Hash)

    a hash of authentication details



44
45
46
47
48
# File 'lib/riak/client/beefcake/socket.rb', line 44

def initialize(tcp_socket, host, authentication)
  @sock = @tcp = tcp_socket
  @host = host
  @auth = authentication
end

Instance Method Details

#tls_socketOpenSSL::SSL::SSLSocket

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the SSLSocket that has a TLS session running. (TLS is a better and safer SSL).

Returns:

  • (OpenSSL::SSL::SSLSocket)


54
55
56
57
58
59
60
61
# File 'lib/riak/client/beefcake/socket.rb', line 54

def tls_socket
  configure_context
  start_tls
  validate_session
  send_authentication
  validate_connection
  return @tls
end