Class: Async::IO::SecureEndpoint
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Endpoint
#accept, each, parse, ssl, tcp, try_convert, udp, unix
Constructor Details
#initialize(endpoint, **options) ⇒ SecureEndpoint
Returns a new instance of SecureEndpoint.
150
151
152
153
|
# File 'lib/async/io/endpoint.rb', line 150
def initialize(endpoint, **options)
@endpoint = endpoint
@options = options
end
|
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
155
156
157
|
# File 'lib/async/io/endpoint.rb', line 155
def endpoint
@endpoint
end
|
#options ⇒ Object
Returns the value of attribute options.
156
157
158
|
# File 'lib/async/io/endpoint.rb', line 156
def options
@options
end
|
Instance Method Details
#bind ⇒ Object
183
184
185
186
187
|
# File 'lib/async/io/endpoint.rb', line 183
def bind
@endpoint.bind do |server|
yield SSLServer.new(server, context)
end
end
|
#connect(&block) ⇒ Object
189
190
191
|
# File 'lib/async/io/endpoint.rb', line 189
def connect(&block)
SSLSocket.connect(@endpoint.connect, context, hostname, &block)
end
|
#context ⇒ Object
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/async/io/endpoint.rb', line 166
def context
if context = @options[:ssl_context]
if params = self.params
context = context.dup
context.set_params(params)
end
else
context = ::OpenSSL::SSL::SSLContext.new
if params = self.params
context.set_params(params)
end
end
return context
end
|
#each ⇒ Object
193
194
195
196
197
198
199
|
# File 'lib/async/io/endpoint.rb', line 193
def each
return to_enum unless block_given?
@endpoint.each do |endpoint|
yield self.class.new(endpoint, @options)
end
end
|
#hostname ⇒ Object
158
159
160
|
# File 'lib/async/io/endpoint.rb', line 158
def hostname
@options[:hostname]
end
|
#params ⇒ Object
162
163
164
|
# File 'lib/async/io/endpoint.rb', line 162
def params
@options[:ssl_params]
end
|