AnyEvent-MP
view release on metacpan or search on metacpan
authenticate and encrypt all traffic.
=item setcert <file>
Set a node certificate (and optionally any CA certificates) from the given
file. The file must contain the key, followed by the certificate, followed
by any CA certificates you want to trust, all in PEM format.
See L<AnyEvent::TLS> for some more details - this sets the C<cert> and
C<ca_cert> options.
=item delcert
Removes the certificate(s) again, which means it is inherited again from
it's parent profile, or stays unset.
=back
=head2 CONFIGURATION/SEEDS
To discover the network you have to specify some seed addresses, which are
basically C<host:port> pairs where you expect some long-running nodes. It
does no harm to have a node as its own seed (they will eventually be
ignored).
=over 4
=item setseeds <host:port>,...
Sets or replaces the list of seeds, which must be specified as a
comma-separated list of C<host:port> pairs. The C<host> can be a hostname,
an IP address, or C<*> to signify all local host addresses (which makes
little sense for seeds, outside some examples, but a lot of sense for
binds).
An empty list is allowed.
Example: use C<doomed> with default port as only seednode.
aemp setseeds doomed
=item delseeds
Removes the seed list again, which means it is inherited again from it's
parent profile, or stays unset.
=item addseed <host:port>
Adds a single seed address.
=item delseed <host:port>
Deletes the given seed address, if it exists.
=back
=head2 CONFIGURATION/BINDS
To be able to be reached from other nodes, a node must I<bind> itself
to some listening socket(s). The list of these can either bs specified
manually, or AnyEvent::MP can guess them. Nodes without any binds are
possible to some extent.
=over 4
=item setbinds <host:port>,...
Sets the list of bind addresses explicitly - see the F<aemp setseeds>
command for the exact syntax. In addition, a value of C<*> for the port,
or not specifying a port, means to use a dynamically-assigned port.
Note that the C<*>, C<*:*> or C<*:port> patterns are very useful here.
Example: bind on a ephemeral port on all local interfaces.
aemp setbinds "*"
Example: bind on a random port on all local interfaces.
aemp setbinds "*:*"
Example: resolve "doomed.mydomain" and try to bind on port C<4040> of all
IP addressess returned.
aep setbinds doomed.mydomain:4040
=item delbinds
Removes the bind list again, which means it is inherited again from it's
parent profile, or stays unset.
=item addbind <host:port>
Adds a single bind address.
=item delbind <host:port>
Deletes the given bind address, if it exists.
=back
=head2 CONFIGURATION/SERVICES
Services are modules (or functions) that are automatically loaded (or
executed) when a node starts. They are especially useful when used in
conjunction with F<aemp run>, to configure which services a node should
run.
Despite the daunting name, services really I<are> nothing more than a
module name or a function name with arguments. The "service" aspect comes
only from the behaviour of the module or function, which is supposed to
implement, well, some kind of service for the node, network etc.
Instead of writing a standalone program for each different node type in
your network, you can simply put your code into a module, and then let the
configuration decide which node runs which "services". This also makes it
easy to combine multiple different services within the same node.
=over 4
=item setservices <initfunc>...
aemp profile server nodeid anon/ seeds doomed,10.0.0.2:5000 binds "*:*"
=item delprofile <name>
Deletes the profile of the given name.
=item setparent <name>
Sets the parent profile to use - values not specified in a profile will be
taken from the parent profile (even recursively, with the global default
config being the default parent). This is useful to configure profile
I<classes> and then to inherit from them for individual nodes.
Note that you can specify circular parent chains and even a parent for the
global configuration. Neither will do you any good, however.
Example: inherit all values not specified in the C<doomed> profile from
the C<server> profile.
aemp profile doomed setparent server
=item delparent
Removes the parent again from the profile, if any was set, so the profile
inherits directly from the global default config again.
=item showprofile <name>
Shows the values of the given profile, and only those, no inherited
values.
=item showconfig <name> <key value...>
Shows the I<effective> config, i.e. the values as used by a node started
with the given profile name. Any additional key-value pairs specified
augment the configuration, just as with C<configure>.
If all arguments are omitted, show the global default config.
=back
=head2 LOW-LEVEL TRANSPORT PROTOCOL
The low-level transport protocol betwene two nodes also has a number of
configurable options, most of which should not be touched unless you know
what you are doing.
=over 4
=item [set|del]secure <boolean>
Normally, nodes allow anything to be done to them by remote nodes,
including remotely-triggered execution of code.
Sometimes a more secure mode is desired - this can be achieved by setting
the secure option to a true value.
When secure mode is enabled, then the node will not execute code locally,
at least not via the normal node protocol. All other messages are still
allowed. This means remote nodes can monitor, kill or snd to local ports
(port names can also be easily guessed).
At the moment, this setting ignores C<snd_on>, C<eval_on> and C<spawn>
requests.
=item [set|del]monitor_timeout <seconds>
Sets the default monitor timeout, that is, when a connection to a node
cannot be established within this many seconds, the node is declared
unreachable and all monitors will fire.
C<30> seconds are usually a good time span for this.
=item [set|del]connect_interval <seconds>
When a connection cannot be established successfully within this many
seconds, try the next transport address (e.g. the next IP address). If
your nodes have a lot of transports, you might have to set this to a low
value so that they will actually all be tried within the monitor timeout
interval.
C<2> is usually a good value, unless you live in new zealand.
=item [set|del]framing_format [array]
Configures the list of framing formats offered to the other side. This is
simply a list of formatted read/write types used with L<AnyEvent::Handle>,
in order of decreasing preference.
Nodes support C<cbor>, C<json> and C<storable> framing formats for data
packets out of the box, and usually choose C<cbor> because it is first in
the list.
Example: prefer the C<My::Personal::Format> framing format over JSON over
Storable.
aemp setframing_format '["My::Personal::Format", "json", "storable"]'
=item [set|del]auth_offer [array]
Configures the list of authentication types that the node offers to the
other side as acceptable, in order of decreasing preference. Only auth
methods that the node can actually support will be offered.
The default is '["tls_sha3_512", "hmac_sha3_512"]' and is usually good
enough.
=item [set|del]auth_accept [array]
Configures the list of authentication types that remote nodes can use to
authenticate, in order of decreasing preference.
The default is '["tls_sha3_512", "hmac_sha3_512", "tls_anon",
"cleartext"]' and is usually good enough.
=item [set|del]autocork <boolean>
Sets the default C<autocork> option value for the L<AnyEvent::Handle>
object used by transports. By default, autocorking is off, potentially
reducing latency.
( run in 0.509 second using v1.01-cache-2.11-cpan-140bd7fdf52 )