2018-10-26 22:09:39 +02:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
2018-11-12 13:02:49 -05:00
|
|
|
|
2018-10-26 22:09:39 +02:00
|
|
|
class ITransport(ABC):
|
|
|
|
|
|
|
|
@abstractmethod
|
2019-02-24 20:58:23 -05:00
|
|
|
def dial(self, multiaddr, self_id, options=None):
|
2018-10-26 22:09:39 +02:00
|
|
|
"""
|
|
|
|
dial a transport to peer listening on multiaddr
|
|
|
|
:param multiaddr: multiaddr of peer
|
2019-02-25 13:11:54 +09:00
|
|
|
:param self_id: peer_id of the dialer (to send to receiver)
|
2018-10-26 22:09:39 +02:00
|
|
|
:param options: optional object
|
|
|
|
:return: list of multiaddrs
|
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def create_listener(self, handler_function, options=None):
|
|
|
|
"""
|
|
|
|
create listener on transport
|
|
|
|
:param options: optional object with properties the listener must have
|
|
|
|
:param handler_function: a function called when a new conntion is received
|
|
|
|
that takes a connection as argument which implements interface-connection
|
|
|
|
:return: a listener object that implements listener_interface.py
|
|
|
|
"""
|