add NegotiableTransport type

This commit is contained in:
Chih Cheng Liang
2019-08-08 15:58:30 +08:00
committed by Kevin Mai-Husan Chia
parent 9851ee01fb
commit dbb702548f
5 changed files with 15 additions and 12 deletions

View File

@ -1,6 +1,11 @@
from typing import Awaitable, Callable, NewType
from typing import Awaitable, Callable, NewType, Union
from libp2p.network.connection.raw_connection_interface import IRawConnection
from libp2p.network.stream.net_stream_interface import INetStream
from libp2p.stream_muxer.abc import IMuxedStream
TProtocol = NewType("TProtocol", str)
StreamHandlerFn = Callable[[INetStream], Awaitable[None]]
NegotiableTransport = Union[IMuxedStream, IRawConnection]