server
plugin helper manages various types of servers.shutdown
method. The plugin shutdowns the launched servers automatically.server_create_connection(title, port, proto: nil, bind: '0.0.0.0', shared: true, backlog: nil, tls_options: nil, **socket_options, &block)
&block
is invoked with the new connection as a parameter.title
: unique symbolport
: the port to listen toproto
: protocol type. { :tcp
, :tls
}bind
: the bind address to listen toshared
: if true
, share socket via server engine for multiple workersbacklog
: the maximum length of the queue for pending connectionstls_options
: options for TLSversion
: set TLS version :TLSv1_1
or :TLSv1_2
.:TLSv1_2
ciphers
: set the list of available cipher suites. (default:"ALL:!aNULL:!eNULL:!SSLv2"
)insecure
: if true
, set TLS verify mode NONE
cert_verifier
: if specified, pass evaluated object to OpenSSL's verify_callback
. See also "cert_verifier
example" section.verify_fqdn
: if true
, validate the server certificate for the hostnamefqdn
: set FQDNenable_system_cert_store
: if true
, enable system default cert storeallow_self_signed_cert
: if true
, allow self-signed certificatecert_paths
: files contain PEM-encoded certificatessocket_options
: options for socketresolve_name
: if true
, resolve the hostnameconnect
: if true
, connect to hostnonblock
: if true
, use non-blocking I/Olinger_timeout
: the timeout (seconds) to set SO_LINGER
recv_timeout
: the timeout (seconds) to set SO_RECVTIMEO
send_timeout
: the timeout (seconds) to set SO_SNDTIMEO
server_create(title, port, proto: nil, bind: '0.0.0.0', shared: true, socket: nil, backlog: nil, tls_options: nil, max_bytes: nil, flags: 0, **socket_options, &callback)
&block
is invoked with parameter(s) on data.title
: unique symbolport
: the port to listen toproto
: protocol type. { :tcp
, :udp
, :tls
}bind
: the bind address to listen toshared
: if true
, share socket via server engine for multiple workerssocket
: socket instance for UDP (only for UDP)backlog
: the maximum length of the queue for pending connectionstls_options
: options for TLSversion
: set TLS version :TLSv1_1
or :TLSv1_2
. (default: :TLSv1_2
)ciphers
: set the list of available cipher suites. (default:"ALL:!aNULL:!eNULL:!SSLv2"
)insecure
: if true
, set TLS verify mode NONE
cert_verifier
: if specified, pass evaluated object to OpenSSL's verify_callback
. See also "cert_verifier
example" section.verify_fqdn
: if true
, validate the server certificate for the hostnamefqdn
: set FQDNenable_system_cert_store
: if true
, enable system default cert storeallow_self_signed_cert
: if true
, allow self signed certificatecert_paths
: files contain PEM-encoded certificatesmax_bytes
: the maximum number of bytes to receive (required for UDP)flags
: zero or more of the MSG_
options (UDP-only)socket_options
: options for socketresolve_name
: if true
, resolve the hostnameconnect
: if true
, connect to hostnonblock
: if true
, use non-blocking I/Olinger_timeout
: the timeout (seconds) to set SO_LINGER
recv_timeout
: the timeout (seconds) to set SO_RECVTIMEO
send_timeout
: the timeout (seconds) to set SO_SNDTIMEO
linger_timeout
SO_LINGER
.0
is to send RST rather than FIN to avoid lots of connections sitting in TIME_WAIT on closing on non-Windows.linger_timeout
is 0
too).cert_path
and private_key_path
are specified, certs generation is disabled. The existing certs are loaded.ca_cert_path
and ca_private_key_path
are specified, certs generation is enabled. You can customize cert generation behavior via generation_...
parameters. See Generated and Signed by Private CA Certs or Self-signed Parameters about parameter details.cert_verifier
examplecert_verifier
is supported since v1.10.0.my_verifier.rb
examplecall
method with two arguments. This object is used as OpenSSL's verify_callback
.Proc
or lambda
Object for the Simple Scenarioclass
for the Complicated Scenarioserver