Method: Libuv::TCP#start_tls

Defined in:
lib/libuv/tcp.rb

#start_tls(args = {}) ⇒ Object

TLS Abstraction ———————-




53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/libuv/tcp.rb', line 53

def start_tls(args = {})
    return self unless @connected && @tls.nil?

    args[:verify_peer] = true if @on_verify

    @handshake = false
    @pending_writes = []
    @tls_options.merge!(args)

    hosts = @tls_options[:hosts]
    if hosts && hosts[0]
        opts = @tls_options.merge(hosts[0])
        @tls = ::RubyTls::SSL::Box.new(opts[:server], self, opts)
        hosts[1..-1].each do |host_opts|
            @tls.add_host(**host_opts)
        end
    else
        @tls = ::RubyTls::SSL::Box.new(@tls_options[:server], self, @tls_options)
    end
    @tls.start
    self
end