py-libp2p/network/connection_interface.py

28 lines
646 B
Python
Raw Normal View History

2018-10-27 03:11:51 +08:00
from abc import ABC, abstractmethod
class IConnection(ABC):
@abstractmethod
def get_observed_addrs(self):
"""
retrieve observed addresses from underlying transport
:return: list of multiaddrs
"""
pass
@abstractmethod
def get_peer_info(self):
"""
retrieve peer info object that the connection connects to
:return: a peer info object
"""
pass
@abstractmethod
def set_peer_info(self, peer_info):
"""
:param peer_info: a peer info object that contains info of peer
2018-10-27 04:16:24 +08:00
:return: True if successful
2018-10-27 03:11:51 +08:00
"""
2018-10-27 04:16:24 +08:00
pass