From cdfcdd528ef85680a01f4473c368bce65c43250b Mon Sep 17 00:00:00 2001 From: Stuckinaboot Date: Thu, 28 Feb 2019 18:12:09 -0500 Subject: [PATCH] Add notifee interface --- libp2p/network/notifee_interface.py | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 libp2p/network/notifee_interface.py diff --git a/libp2p/network/notifee_interface.py b/libp2p/network/notifee_interface.py new file mode 100644 index 0000000..fbc61f4 --- /dev/null +++ b/libp2p/network/notifee_interface.py @@ -0,0 +1,46 @@ +from abc import ABC, abstractmethod + + +class INotifee(ABC): + + @abstractmethod + def opened_stream(self, network, stream): + """ + :param network: network the stream was opened on + :param stream: stream that was opened + """ + + @abstractmethod + def closed_stream(self, network, stream): + """ + :param network: network the stream was closed on + :param stream: stream that was closed + """ + + @abstractmethod + def connected(self, network, conn): + """ + :param network: network the connection was opened on + :param conn: connection that was opened + """ + + @abstractmethod + def disconnected(self, network, conn): + """ + :param network: network the connection was closed on + :param conn: connection that was closed + """ + + @abstractmethod + def listen(self, network, multiaddr): + """ + :param network: network the listener is listening on + :param multiaddr: multiaddress listener is listening on + """ + + @abstractmethod + def listen_close(self, network, multiaddr): + """ + :param network: network the connection was opened on + :param multiaddr: multiaddress listener is no longer listening on + """