%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;1m  nodes(Arg, InfoOpts)[0m

[;;4mSince[0m:
  OTP 25.1

  Returns a list of [;;4mNodeInfo[0m tuples.

  The first element is the node name. Nodes to be included in the
  list are determined by the first argument [;;4mArg[0m in the same way as
  for [;;4mnodes(Arg)[0m. The second element of [;;4mNodeInfo[0m tuples is a map
  containing further information about the node identified by the
  first element. The information present in this map is determined
  by the [;;4mInfoOpts[0m map passed as the second argument. Currently the
  following associations are allowed in the [;;4mInfoOpts[0m map:

   • [;;4mconnection_id => boolean()[0m - If the value of the
     association equals [;;4mtrue[0m, the [;;4mInfo[0m map in the returned
     result will contain the key [;;4mconnection_id[0m associated with
     the value [;;4mConnectionId[0m. If [;;4mConnectionId[0m equals [;;4m[0m
     [;;4mundefined[0m, the node is not connected to the node which the
     caller is executing on, or is the node which the caller is
     executing on. If [;;4mConnectionId[0m is an integer, the node is
     currently connected to the node which the caller is
     executing on.

     The integer connection identifier value together with a node
     name identifies a specific connection instance to the node
     with that node name. The connection identifier value is node
     local. That is, on the other node the connection identifier
     will not be the same value. If a connection is taken down
     and then taken up again, the connection identifier value
     will change for the connection to that node. The amount of
     values for connection identifiers are limited, so it is
     possible to see the same value for different instances, but
     quite unlikely. It is undefined how the value change between
     two consecutive connection instances.

   • [;;4mnode_type => boolean()[0m - If the value of the association
     equals [;;4mtrue[0m, the [;;4mInfo[0m map in the returned result will
     contain the key [;;4mnode_type[0m associated with the value [;;4m[0m
     [;;4mNodeTypeInfo[0m. Currently the following node types exist:

      ￮ [;;4mvisible[0m - The node is connected to the node of the
        calling process through an ordinary visible
        connection. That is, the node name would appear in the
        result returned by [;;4mnodes/0[0m.

      ￮ [;;4mhidden[0m - The node is connected to the node of the
        calling process through a hidden connection. That is,
        the node name would not appear in the result
        returned by [;;4mnodes/0[0m.

      ￮ [;;4mthis[0m - This is the node of the calling process.

      ￮ [;;4mknown[0m - The node is not connected but known to the
        node of the calling process.

  Example:

    (a@localhost)1> nodes([this, connected], #{connection_id=>true, node_type=>true}).
    [{c@localhost,#{connection_id => 13892108,node_type => hidden}},
     {b@localhost,#{connection_id => 3067553,node_type => visible}},
     {a@localhost,#{connection_id => undefined,node_type => this}}]
    (a@localhost)2>
