conn interface

This commit is contained in:
zixuanzh 2018-10-26 21:11:51 +02:00
parent 4bae3ad3c1
commit 6e46e3ec09
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
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
:return: true if successful
"""

0
network/tcp.py Normal file
View File

View File