# circuits.node.node module

Node

this module manage node (start server, add peer, …) .. seealso:: Examples in `examples/node`

class circuits.node.node.Node(*args, **kwargs)

  Bases: `BaseComponent`

  this class manage node (start server, add peer, …) .. seealso:: Examples in `examples/node`

  Start node system.

  Parameters:

    - port (int) – An optional keyword argument which if defined, start server on this port. Default: `None` (don’t start the server)

    - server_ip (str) – An optional keyword argument which define ip where the socket has listen to. Default: `0.0.0.0` (all ip is allowed)

    - channel (str) – An optional keyword argument which if defined, set channel used for node event. Default: `node`

    - receive_event_firewall (method) – An optional keyword argument which if defined, set function or method to call to check if event is allowed for sending. Default: `None` (no firewall)

    - send_event_firewall (method) – An optional keyword argument which if defined, set function or method to call to check if event is allowed for executing Default: `None` (no firewall)

  channel = 'node'
  add(connection_name, hostname, port, **kwargs)

    Add new peer to the node.

    Parameters:

      - connection_name (str) – Connection name.

      - hostname (str) – hostname of the remote node.

      - port (int) – port of the remote node.

      - auto_remote_event (dict) – An optional keyword argument which if defined, bind events automatically to remote execution. Default: `{}` (no events)

      - channel (str) – An optional keyword argument which if defined, set channel used for client event. If this keyword is not defined the method will generate the channel name automatically.

      - reconnect_delay (int) – An optional keyword argument which if defined, set auto reconnect delay. Default: `10` (seconde)

      - receive_event_firewall (method) – An optional keyword argument which if defined, function or method to call for check if event is allowed for sending. Default: `None` (no firewall)

      - send_event_firewall (method) – An optional keyword argument which if defined, setfunction or method to call to check if event is allowed for executing Default: `None` (no firewall)

    Returns:

      Channel used on client event.

    Return type:

      str

  get_connection_names()

    Get connections names

    Returns:

      The list of connections names

    Return type:

      list of str

  get_peer(connection_name)

    Get a client object by name

    Parameters:

      connection_name (str) – Connection name.

    Returns:

      The Client object

    Return type:

      `circuits.node.client.Client`