Where a cluster node accepts peers: its name, address, and port,
written name@host:port.
{:ok, peer} = Sovite.Cluster.Peer.parse("mx2@10.0.0.2:4370")
{:ok, peer} = Sovite.Cluster.Peer.parse("mx2@[2001:db8::2]:4370")
{:ok, peer} = Sovite.Cluster.Peer.parse("mx2@10.0.0.2", 4370)The node name is name@host. A host that is not an IP address is
resolved when parsing. Parsing creates the node name atom, so only
parse names from trusted sources, such as a config file.
Summary
Functions
Formats a peer as name@host:port.
Parses a node name, name@host, without resolving it.
Parses name@host:port, or name@host with default_port. IPv6
addresses are in brackets.
Types
@type t() :: %Sovite.Cluster.Peer{ ip: :inet.ip_address(), name: node(), port: :inet.port_number() }
Functions
Formats a peer as name@host:port.
Parses a node name, name@host, without resolving it.
@spec parse(String.t(), :inet.port_number() | nil) :: {:ok, t()} | {:error, String.t()}
Parses name@host:port, or name@host with default_port. IPv6
addresses are in brackets.