Module: IO::Endpoint

Defined in:
lib/io/endpoint/version.rb,
lib/io/endpoint/wrapper.rb,
lib/io/endpoint/tls/openssl.rb,
lib/io/endpoint/ssl_endpoint.rb,
lib/io/endpoint/host_endpoint.rb,
lib/io/endpoint/unix_endpoint.rb,
lib/io/endpoint/bound_endpoint.rb,
lib/io/endpoint/named_endpoints.rb,
lib/io/endpoint/socket_endpoint.rb,
lib/io/endpoint/tls/trust_store.rb,
lib/io/endpoint/address_endpoint.rb,
lib/io/endpoint/tls/certificates.rb,
lib/io/endpoint/tls/configuration.rb,
lib/io/endpoint/composite_endpoint.rb,
lib/io/endpoint/connected_endpoint.rb,
lib/io/endpoint/generic.rb,
lib/io/endpoint.rb

Overview

Represents a collection of endpoint classes for network I/O operations.

Defined Under Namespace

Modules: TLS Classes: AddressEndpoint, BoundEndpoint, CompositeEndpoint, ConnectedEndpoint, Generic, HostEndpoint, NamedEndpoints, SSLEndpoint, SocketEndpoint, UNIXEndpoint, Wrapper

Constant Summary collapse

VERSION =
"0.18.0"
Address =
Addrinfo

Class Method Summary collapse

Class Method Details

.composite(*endpoints, **options) ⇒ Object

Create a composite endpoint from multiple endpoints.



100
101
102
# File 'lib/io/endpoint/composite_endpoint.rb', line 100

def self.composite(*endpoints, **options)
	CompositeEndpoint.new(endpoints, **options)
end

.file_descriptor_limitObject

Get the current file descriptor limit for the process.



17
18
19
# File 'lib/io/endpoint.rb', line 17

def self.file_descriptor_limit
	Process.getrlimit(Process::RLIMIT_NOFILE).first
end

.named(**endpoints) ⇒ Object

Create a named endpoints collection from keyword arguments.

Examples:

Create a named endpoints collection

endpoints = IO::Endpoint.named(
	http1: IO::Endpoint.tcp("localhost", 8080),
	http2: IO::Endpoint.tcp("localhost", 8090)
)


89
90
91
# File 'lib/io/endpoint/named_endpoints.rb', line 89

def self.named(**endpoints)
	NamedEndpoints.new(endpoints)
end

.socket(socket, **options) ⇒ Object

Create a socket endpoint from an existing socket.



64
65
66
# File 'lib/io/endpoint/socket_endpoint.rb', line 64

def self.socket(socket, **options)
	SocketEndpoint.new(socket, **options)
end

.ssl(*arguments, ssl_context: nil, tls_configuration: nil, hostname: nil, **options) ⇒ Object



195
196
197
# File 'lib/io/endpoint/ssl_endpoint.rb', line 195

def self.ssl(*arguments, ssl_context: nil, tls_configuration: nil, hostname: nil, **options)
	SSLEndpoint.new(self.tcp(*arguments, **options), ssl_context: ssl_context, tls_configuration: tls_configuration, hostname: hostname)
end

.tcp(*arguments, **options) ⇒ Object



102
103
104
105
106
# File 'lib/io/endpoint/host_endpoint.rb', line 102

def self.tcp(*arguments, **options)
	arguments[3] = ::Socket::SOCK_STREAM
	
	HostEndpoint.new(arguments, **options)
end

.udp(*arguments, **options) ⇒ Object



112
113
114
115
116
# File 'lib/io/endpoint/host_endpoint.rb', line 112

def self.udp(*arguments, **options)
	arguments[3] = ::Socket::SOCK_DGRAM
	
	HostEndpoint.new(arguments, **options)
end

.unix(path = "", type = ::Socket::SOCK_STREAM, **options) ⇒ Object



156
157
158
# File 'lib/io/endpoint/unix_endpoint.rb', line 156

def self.unix(path = "", type = ::Socket::SOCK_STREAM, **options)
	UNIXEndpoint.new(path, type, **options)
end