peer_connected -- Hook fired when a peer connects and completes handshake
DESCRIPTION
The peer_connected hook is called whenever a peer has connected and successfully completed the cryptographic handshake.
This is a chained hook: the first plugin returning "disconnect" stops further processing.
Plugins can call listpeers to retrieve additional information about the peer.
HOOK PAYLOAD
- peer (object):
- id (pubkey): The node_id of the connected peer.
- direction (string) (one of "in", "out"): Connection direction:
infor incoming,outfor outgoing. - addr (string): The
addrfield shows the address that we are connected to ourselves, not the gossiped list of known addresses.
In particular this means that the port for incoming connections is an ephemeral port, that may not be available for reconnections. - features (hex): Feature bits advertised by the peer, encoded as hex.
- remote_addr (string, optional): Our own address as reported by the remote peer. Helps with detecting our own IPv4 changes behind NAT.
HOOK RETURN
- result (string) (one of "continue", "disconnect"): Whether to allow the connection to proceed or disconnect the peer.
- error_message (string, optional): Optional error message sent to the peer before disconnection.
Only used if result is "disconnect".
SEE ALSO
lightning-listpeers(7)