A peer on the mesh network, as reported by the local mesh daemon.
Note that node_name/2 creates atoms at runtime (Erlang node names are
atoms). This is safe under the library's trust model — the local mesh
daemon is trusted input and a mesh has a bounded set of peer IPs — but it
is one more reason not to point the strategies at untrusted data sources.
Summary
Functions
Returns true when the peer's hostname starts with any of the given prefixes.
Builds a node name from a basename and the peer's mesh IP.
Types
ip— mesh IPv4 address as a string (e.g."100.64.0.7")hostname— bare host name (first DNS label, e.g."myapp-2"), or the mesh IP on meshes that have no hostnamesonline?— whether the daemon reports the peer as online
Functions
Returns true when the peer's hostname starts with any of the given prefixes.
iex> peer = %LibclusterMesh.Peer{ip: "100.64.0.7", hostname: "myapp-2"}
iex> LibclusterMesh.Peer.matches?(peer, ["myapp-"])
true
iex> LibclusterMesh.Peer.matches?(peer, ["other"])
false
Builds a node name from a basename and the peer's mesh IP.
iex> peer = %LibclusterMesh.Peer{ip: "100.64.0.7", hostname: "myapp-2"}
iex> LibclusterMesh.Peer.node_name(peer, "myapp")
:"myapp@100.64.0.7"