Sha256: 5082dbf849b762266c40b87ec29501904ad493ef83eda387a0a0c632cf4cc0e5
Contents?: true
Size: 903 Bytes
Versions: 15
Compression:
Stored size: 903 Bytes
Contents
require 'openssl' module LogStashLogger module Device class TCP < Socket attr_reader :ssl_certificate def initialize(opts) super @ssl_certificate = opts[:ssl_certificate] @use_ssl = !!(@ssl_certificate || opts[:use_ssl] || opts[:ssl_enable]) end def use_ssl? @use_ssl || !@ssl_certificate.nil? end protected def connect if use_ssl? ssl_connect else non_ssl_connect end @io end def non_ssl_connect @io = TCPSocket.new(@host, @port).tap do |socket| socket.sync = sync unless sync.nil? end end def ssl_connect non_ssl_connect #openssl_cert = OpenSSL::X509::Certificate.new(::File.read(@ssl_certificate)) @io = OpenSSL::SSL::SSLSocket.new(@io) @io.connect end end end end
Version data entries
15 entries across 15 versions & 1 rubygems