PR feedback
- Use `TMuxerOptions` and `TSecurityOptions` in libp2p/__init__.py - Remove the default value for `muxer_transports_by_protocol` in `MuxerMultistream` and `secure_transports_by_protocol` `SecureMultistream`
This commit is contained in:
parent
1bd18c84f2
commit
37bee9fb16
|
@ -1,5 +1,5 @@
|
|||
import asyncio
|
||||
from typing import Mapping, Sequence
|
||||
from typing import Sequence
|
||||
|
||||
from libp2p.crypto.keys import KeyPair
|
||||
from libp2p.crypto.rsa import create_new_key_pair
|
||||
|
@ -15,10 +15,9 @@ from libp2p.routing.interfaces import IPeerRouting
|
|||
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||
from libp2p.security.insecure.transport import PLAINTEXT_PROTOCOL_ID, InsecureTransport
|
||||
import libp2p.security.secio.transport as secio
|
||||
from libp2p.security.secure_transport_interface import ISecureTransport
|
||||
from libp2p.stream_muxer.mplex.mplex import MPLEX_PROTOCOL_ID, Mplex
|
||||
from libp2p.transport.tcp.tcp import TCP
|
||||
from libp2p.transport.typing import TMuxerClass, TMuxerOptions, TSecurityOptions
|
||||
from libp2p.transport.typing import TMuxerOptions, TSecurityOptions
|
||||
from libp2p.transport.upgrader import TransportUpgrader
|
||||
from libp2p.typing import TProtocol
|
||||
|
||||
|
|
|
@ -31,14 +31,13 @@ class SecurityMultistream(ABC):
|
|||
multiselect: Multiselect
|
||||
multiselect_client: MultiselectClient
|
||||
|
||||
def __init__(self, secure_transports_by_protocol: TSecurityOptions = None) -> None:
|
||||
def __init__(self, secure_transports_by_protocol: TSecurityOptions) -> None:
|
||||
self.transports = OrderedDict()
|
||||
self.multiselect = Multiselect()
|
||||
self.multiselect_client = MultiselectClient()
|
||||
|
||||
if secure_transports_by_protocol is not None:
|
||||
for protocol, transport in secure_transports_by_protocol.items():
|
||||
self.add_transport(protocol, transport)
|
||||
for protocol, transport in secure_transports_by_protocol.items():
|
||||
self.add_transport(protocol, transport)
|
||||
|
||||
def add_transport(self, protocol: TProtocol, transport: ISecureTransport) -> None:
|
||||
"""
|
||||
|
|
|
@ -26,13 +26,12 @@ class MuxerMultistream:
|
|||
multiselect: Multiselect
|
||||
multiselect_client: MultiselectClient
|
||||
|
||||
def __init__(self, muxer_transports_by_protocol: TMuxerOptions = None) -> None:
|
||||
def __init__(self, muxer_transports_by_protocol: TMuxerOptions) -> None:
|
||||
self.transports = OrderedDict()
|
||||
self.multiselect = Multiselect()
|
||||
self.multiselect_client = MultiselectClient()
|
||||
if muxer_transports_by_protocol is not None:
|
||||
for protocol, transport in muxer_transports_by_protocol.items():
|
||||
self.add_transport(protocol, transport)
|
||||
for protocol, transport in muxer_transports_by_protocol.items():
|
||||
self.add_transport(protocol, transport)
|
||||
|
||||
def add_transport(self, protocol: TProtocol, transport: TMuxerClass) -> None:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user