Method: H2::Server::HTTPS#initialize

Defined in:
lib/h2/server/https.rb

#initialize(host:, port:, sni: {}, **options, &on_connection) ⇒ HTTPS

create a new h2 server that uses SNI to determine TLS cert/key to use

SNI options with default callback

:sni

Hash with domain name String keys and Hash values:

:cert

String TLS certificate

:extra_chain_cert

String TLS certificate

:key

String TLS key

SNI options with custom callback

:sni

Hash:

:callback

Proc creates OpenSSL::SSL::SSLContext for each

connection

Parameters:

  • host (String)

    the IP address for this server to listen on

  • port (Integer)

    the TCP port for this server to listen on

  • sni (Hash) (defaults to: {})

    the SNI option hash with certs/keys for domains

  • options (Hash)
  • [String] (Hash)

    a customizable set of options

See Also:



43
44
45
46
47
48
49
50
# File 'lib/h2/server/https.rb', line 43

def initialize host:, port:, sni: {}, **options, &on_connection
  @sni          = sni
  @sni_callback = @sni[:callback] || method(:sni_callback)
  @tcpserver    = Celluloid::IO::TCPServer.new host, port
  @sslserver    = Celluloid::IO::SSLServer.new @tcpserver, create_ssl_context(options)
  options.merge! host: host, port: port, sni: sni
  super @sslserver, options, &on_connection
end