Module: IO::Endpoint

Defined in:
lib/io/endpoint/version.rb,
lib/io/endpoint/wrapper.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/socket_endpoint.rb,
lib/io/endpoint/address_endpoint.rb,
lib/io/endpoint/composite_endpoint.rb,
lib/io/endpoint/connected_endpoint.rb,
lib/io/endpoint/generic.rb,
lib/io/endpoint.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"0.15.1"
Address =
Addrinfo

Class Method Summary collapse

Class Method Details

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



71
72
73
# File 'lib/io/endpoint/composite_endpoint.rb', line 71

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

.file_descriptor_limitObject



11
12
13
# File 'lib/io/endpoint.rb', line 11

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

.socket(socket, **options) ⇒ Object



44
45
46
# File 'lib/io/endpoint/socket_endpoint.rb', line 44

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

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

Parameters:

  • arguments
  • ssl_context (OpenSSL::SSL::SSLContext, nil) (defaults to: nil)
  • hostname (String, nil) (defaults to: nil)
  • options

    keyword arguments passed through to tcp

Returns:



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

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

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

Parameters:

  • arguments

    nodename, service, family, socktype, protocol, flags. ‘socktype` will be set to Socket::SOCK_STREAM.

  • options

    keyword arguments passed on to IO::Endpoint::HostEndpoint#initialize

Returns:



86
87
88
89
90
# File 'lib/io/endpoint/host_endpoint.rb', line 86

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

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

Parameters:

  • arguments

    nodename, service, family, socktype, protocol, flags. ‘socktype` will be set to Socket::SOCK_DGRAM.

  • options

    keyword arguments passed on to IO::Endpoint::HostEndpoint#initialize

Returns:



96
97
98
99
100
# File 'lib/io/endpoint/host_endpoint.rb', line 96

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

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

Parameters:

Returns:



56
57
58
# File 'lib/io/endpoint/unix_endpoint.rb', line 56

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