mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 08:00:54 +00:00
transport interface
This commit is contained in:
@ -0,0 +1,24 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
class ITransport(ABC):
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def dial(self, multiaddr, options=None):
|
||||||
|
"""
|
||||||
|
dial a transport to peer listening on multiaddr
|
||||||
|
:param multiaddr: multiaddr of peer
|
||||||
|
:param options: optional object
|
||||||
|
:return: list of multiaddrs
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@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
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user