2019-09-12 00:38:12 +08:00
|
|
|
from abc import abstractmethod
|
|
|
|
from typing import Tuple
|
|
|
|
|
2020-01-07 21:50:03 +08:00
|
|
|
import trio
|
|
|
|
|
2019-09-12 00:38:12 +08:00
|
|
|
from libp2p.io.abc import Closer
|
|
|
|
from libp2p.network.stream.net_stream_interface import INetStream
|
|
|
|
from libp2p.stream_muxer.abc import IMuxedConn
|
|
|
|
|
|
|
|
|
|
|
|
class INetConn(Closer):
|
2019-09-23 15:46:50 +08:00
|
|
|
muxed_conn: IMuxedConn
|
2020-01-07 21:50:03 +08:00
|
|
|
event_started: trio.Event
|
2019-09-12 00:38:12 +08:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
async def new_stream(self) -> INetStream:
|
|
|
|
...
|
|
|
|
|
|
|
|
@abstractmethod
|
2020-01-07 21:50:03 +08:00
|
|
|
def get_streams(self) -> Tuple[INetStream, ...]:
|
2019-09-12 00:38:12 +08:00
|
|
|
...
|