Class Mongo::Address::IPv4
In: lib/mongo/address/ipv4.rb
Parent: Object

Sets up resolution with IPv4 support if the address is an ip address.

@since 2.0.0

Methods

new   parse   socket  

Constants

MATCH = Regexp.new('/\./').freeze   The regular expression to use to match an IPv4 ip address.

@since 2.0.0

SPLIT = ':'.freeze   Split value constant.

@since 2.1.0

Attributes

host  [R]  @return [ String ] host The host.
host_name  [R]  @return [ String ] host_name The original host name.
port  [R]  @return [ Integer ] port The port.

Public Class methods

Initialize the IPv4 resolver.

@example Initialize the resolver.

  IPv4.new("127.0.0.1", 27017, 'localhost')

@param [ String ] host The host. @param [ Integer ] port The port.

@since 2.0.0

Parse an IPv4 address into its host and port.

@example Parse the address.

  IPv4.parse("127.0.0.1:28011")

@param [ String ] address The address to parse.

@return [ Array<String, Integer> ] The host and port pair.

@since 2.0.0

Public Instance methods

Get a socket for the provided address type, given the options.

@example Get an IPv4 socket.

  ipv4.socket(5, :ssl => true)

@param [ Float ] socket_timeout The socket timeout. @param [ Hash ] ssl_options SSL options. @param [ Hash ] options The options.

@option options [ Float ] :connect_timeout Connect timeout.

@return [ Mongo::Socket::SSL, Mongo::Socket::TCP ] The socket.

@since 2.0.0

[Validate]