86d4ce1da8
- Add `StreamCommunicator` and `RawConnectionCommunicator`, read/write messages with delim codec, with `IMuxedStream` and `IRawConnection` respectively. - Use it in `Multiselect` and `MultiselectClient`.
13 lines
415 B
Python
13 lines
415 B
Python
import asyncio
|
|
from typing import TYPE_CHECKING, Awaitable, Callable, NewType, Union
|
|
|
|
if TYPE_CHECKING:
|
|
from libp2p.network.stream.net_stream_interface import INetStream # noqa: F401
|
|
from libp2p.stream_muxer.abc import IMuxedStream # noqa: F401
|
|
|
|
TProtocol = NewType("TProtocol", str)
|
|
StreamHandlerFn = Callable[["INetStream"], Awaitable[None]]
|
|
|
|
|
|
StreamReader = Union["IMuxedStream", asyncio.StreamReader]
|