mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 07:30:55 +00:00
conn interface
This commit is contained in:
26
network/connection_interface.py
Normal file
26
network/connection_interface.py
Normal 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
0
network/tcp.py
Normal file
0
network/transport_interface.py
Normal file
0
network/transport_interface.py
Normal file
Reference in New Issue
Block a user