mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
rename typing.py to custom_types.py for clarity
This commit is contained in:
@ -32,10 +32,10 @@ libp2p.exceptions module
|
|||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
libp2p.typing module
|
libp2p.custom_types module
|
||||||
--------------------
|
--------------------------
|
||||||
|
|
||||||
.. automodule:: libp2p.typing
|
.. automodule:: libp2p.custom_types
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|||||||
@ -7,15 +7,15 @@ import trio
|
|||||||
from libp2p import (
|
from libp2p import (
|
||||||
new_host,
|
new_host,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.net_stream_interface import (
|
from libp2p.network.stream.net_stream_interface import (
|
||||||
INetStream,
|
INetStream,
|
||||||
)
|
)
|
||||||
from libp2p.peer.peerinfo import (
|
from libp2p.peer.peerinfo import (
|
||||||
info_from_p2p_addr,
|
info_from_p2p_addr,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
PROTOCOL_ID = TProtocol("/chat/1.0.0")
|
PROTOCOL_ID = TProtocol("/chat/1.0.0")
|
||||||
MAX_READ_LEN = 2**32 - 1
|
MAX_READ_LEN = 2**32 - 1
|
||||||
|
|||||||
@ -9,15 +9,15 @@ from libp2p import (
|
|||||||
from libp2p.crypto.secp256k1 import (
|
from libp2p.crypto.secp256k1 import (
|
||||||
create_new_key_pair,
|
create_new_key_pair,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.net_stream_interface import (
|
from libp2p.network.stream.net_stream_interface import (
|
||||||
INetStream,
|
INetStream,
|
||||||
)
|
)
|
||||||
from libp2p.peer.peerinfo import (
|
from libp2p.peer.peerinfo import (
|
||||||
info_from_p2p_addr,
|
info_from_p2p_addr,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
PROTOCOL_ID = TProtocol("/echo/1.0.0")
|
PROTOCOL_ID = TProtocol("/echo/1.0.0")
|
||||||
|
|
||||||
|
|||||||
@ -6,15 +6,15 @@ import trio
|
|||||||
from libp2p import (
|
from libp2p import (
|
||||||
new_host,
|
new_host,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.net_stream_interface import (
|
from libp2p.network.stream.net_stream_interface import (
|
||||||
INetStream,
|
INetStream,
|
||||||
)
|
)
|
||||||
from libp2p.peer.peerinfo import (
|
from libp2p.peer.peerinfo import (
|
||||||
info_from_p2p_addr,
|
info_from_p2p_addr,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
PING_PROTOCOL_ID = TProtocol("/ipfs/ping/1.0.0")
|
PING_PROTOCOL_ID = TProtocol("/ipfs/ping/1.0.0")
|
||||||
PING_LENGTH = 32
|
PING_LENGTH = 32
|
||||||
|
|||||||
@ -6,6 +6,9 @@ from libp2p.crypto.keys import (
|
|||||||
from libp2p.crypto.rsa import (
|
from libp2p.crypto.rsa import (
|
||||||
create_new_key_pair,
|
create_new_key_pair,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.host.basic_host import (
|
from libp2p.host.basic_host import (
|
||||||
BasicHost,
|
BasicHost,
|
||||||
)
|
)
|
||||||
@ -52,9 +55,6 @@ from libp2p.transport.typing import (
|
|||||||
from libp2p.transport.upgrader import (
|
from libp2p.transport.upgrader import (
|
||||||
TransportUpgrader,
|
TransportUpgrader,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_new_rsa_identity() -> KeyPair:
|
def generate_new_rsa_identity() -> KeyPair:
|
||||||
|
|||||||
@ -16,6 +16,10 @@ from libp2p.crypto.keys import (
|
|||||||
PrivateKey,
|
PrivateKey,
|
||||||
PublicKey,
|
PublicKey,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
StreamHandlerFn,
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.host.defaults import (
|
from libp2p.host.defaults import (
|
||||||
get_default_protocols,
|
get_default_protocols,
|
||||||
)
|
)
|
||||||
@ -53,10 +57,6 @@ from libp2p.protocol_muxer.multiselect_communicator import (
|
|||||||
from libp2p.tools.async_service import (
|
from libp2p.tools.async_service import (
|
||||||
background_trio_service,
|
background_trio_service,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
StreamHandlerFn,
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .host_interface import (
|
from .host_interface import (
|
||||||
IHost,
|
IHost,
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from libp2p.identity.identify.protocol import (
|
|||||||
from libp2p.identity.identify.protocol import ID as IdentifyID
|
from libp2p.identity.identify.protocol import ID as IdentifyID
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from libp2p.typing import (
|
from libp2p.custom_types import (
|
||||||
StreamHandlerFn,
|
StreamHandlerFn,
|
||||||
TProtocol,
|
TProtocol,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -16,6 +16,10 @@ from libp2p.crypto.keys import (
|
|||||||
PrivateKey,
|
PrivateKey,
|
||||||
PublicKey,
|
PublicKey,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
StreamHandlerFn,
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.network_interface import (
|
from libp2p.network.network_interface import (
|
||||||
INetworkService,
|
INetworkService,
|
||||||
)
|
)
|
||||||
@ -28,10 +32,6 @@ from libp2p.peer.id import (
|
|||||||
from libp2p.peer.peerinfo import (
|
from libp2p.peer.peerinfo import (
|
||||||
PeerInfo,
|
PeerInfo,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
StreamHandlerFn,
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IHost(ABC):
|
class IHost(ABC):
|
||||||
|
|||||||
@ -4,6 +4,9 @@ import time
|
|||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.host.host_interface import (
|
from libp2p.host.host_interface import (
|
||||||
IHost,
|
IHost,
|
||||||
)
|
)
|
||||||
@ -16,9 +19,6 @@ from libp2p.network.stream.net_stream_interface import (
|
|||||||
INetStream,
|
INetStream,
|
||||||
)
|
)
|
||||||
from libp2p.peer.id import ID as PeerID
|
from libp2p.peer.id import ID as PeerID
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
ID = TProtocol("/ipfs/ping/1.0.0")
|
ID = TProtocol("/ipfs/ping/1.0.0")
|
||||||
PING_LENGTH = 32
|
PING_LENGTH = 32
|
||||||
|
|||||||
@ -4,6 +4,10 @@ from multiaddr import (
|
|||||||
Multiaddr,
|
Multiaddr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
StreamHandlerFn,
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.host.host_interface import (
|
from libp2p.host.host_interface import (
|
||||||
IHost,
|
IHost,
|
||||||
)
|
)
|
||||||
@ -13,10 +17,6 @@ from libp2p.network.stream.exceptions import (
|
|||||||
from libp2p.network.stream.net_stream_interface import (
|
from libp2p.network.stream.net_stream_interface import (
|
||||||
INetStream,
|
INetStream,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
StreamHandlerFn,
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .pb.identify_pb2 import (
|
from .pb.identify_pb2 import (
|
||||||
Identify,
|
Identify,
|
||||||
|
|||||||
@ -13,6 +13,9 @@ from multiaddr import (
|
|||||||
Multiaddr,
|
Multiaddr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
StreamHandlerFn,
|
||||||
|
)
|
||||||
from libp2p.network.connection.net_connection_interface import (
|
from libp2p.network.connection.net_connection_interface import (
|
||||||
INetConn,
|
INetConn,
|
||||||
)
|
)
|
||||||
@ -28,9 +31,6 @@ from libp2p.tools.async_service import (
|
|||||||
from libp2p.transport.listener_interface import (
|
from libp2p.transport.listener_interface import (
|
||||||
IListener,
|
IListener,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
StreamHandlerFn,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .stream.net_stream_interface import (
|
from .stream.net_stream_interface import (
|
||||||
INetStream,
|
INetStream,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ from typing import (
|
|||||||
Optional,
|
Optional,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.stream_muxer.abc import (
|
from libp2p.stream_muxer.abc import (
|
||||||
IMuxedStream,
|
IMuxedStream,
|
||||||
)
|
)
|
||||||
@ -10,9 +13,6 @@ from libp2p.stream_muxer.exceptions import (
|
|||||||
MuxedStreamEOF,
|
MuxedStreamEOF,
|
||||||
MuxedStreamReset,
|
MuxedStreamReset,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
StreamClosed,
|
StreamClosed,
|
||||||
|
|||||||
@ -2,15 +2,15 @@ from abc import (
|
|||||||
abstractmethod,
|
abstractmethod,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.io.abc import (
|
from libp2p.io.abc import (
|
||||||
ReadWriteCloser,
|
ReadWriteCloser,
|
||||||
)
|
)
|
||||||
from libp2p.stream_muxer.abc import (
|
from libp2p.stream_muxer.abc import (
|
||||||
IMuxedConn,
|
IMuxedConn,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class INetStream(ReadWriteCloser):
|
class INetStream(ReadWriteCloser):
|
||||||
|
|||||||
@ -8,6 +8,9 @@ from multiaddr import (
|
|||||||
)
|
)
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
StreamHandlerFn,
|
||||||
|
)
|
||||||
from libp2p.io.abc import (
|
from libp2p.io.abc import (
|
||||||
ReadWriteCloser,
|
ReadWriteCloser,
|
||||||
)
|
)
|
||||||
@ -43,9 +46,6 @@ from libp2p.transport.transport_interface import (
|
|||||||
from libp2p.transport.upgrader import (
|
from libp2p.transport.upgrader import (
|
||||||
TransportUpgrader,
|
TransportUpgrader,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
StreamHandlerFn,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ..exceptions import (
|
from ..exceptions import (
|
||||||
MultiError,
|
MultiError,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from libp2p.typing import (
|
from libp2p.custom_types import (
|
||||||
StreamHandlerFn,
|
StreamHandlerFn,
|
||||||
TProtocol,
|
TProtocol,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from collections.abc import (
|
|||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
|
|
||||||
from libp2p.typing import (
|
from libp2p.custom_types import (
|
||||||
TProtocol,
|
TProtocol,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -6,12 +6,12 @@ from collections.abc import (
|
|||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.protocol_muxer.multiselect_communicator_interface import (
|
from libp2p.protocol_muxer.multiselect_communicator_interface import (
|
||||||
IMultiselectCommunicator,
|
IMultiselectCommunicator,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IMultiselectClient(ABC):
|
class IMultiselectClient(ABC):
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from abc import (
|
|||||||
abstractmethod,
|
abstractmethod,
|
||||||
)
|
)
|
||||||
|
|
||||||
from libp2p.typing import (
|
from libp2p.custom_types import (
|
||||||
StreamHandlerFn,
|
StreamHandlerFn,
|
||||||
TProtocol,
|
TProtocol,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -11,15 +11,15 @@ from typing import (
|
|||||||
AsyncContextManager,
|
AsyncContextManager,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.peer.id import (
|
from libp2p.peer.id import (
|
||||||
ID,
|
ID,
|
||||||
)
|
)
|
||||||
from libp2p.tools.async_service import (
|
from libp2p.tools.async_service import (
|
||||||
ServiceAPI,
|
ServiceAPI,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .pb import (
|
from .pb import (
|
||||||
rpc_pb2,
|
rpc_pb2,
|
||||||
|
|||||||
@ -6,15 +6,15 @@ import logging
|
|||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.exceptions import (
|
from libp2p.network.stream.exceptions import (
|
||||||
StreamClosed,
|
StreamClosed,
|
||||||
)
|
)
|
||||||
from libp2p.peer.id import (
|
from libp2p.peer.id import (
|
||||||
ID,
|
ID,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
from libp2p.utils import (
|
from libp2p.utils import (
|
||||||
encode_varint_prefixed,
|
encode_varint_prefixed,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -17,6 +17,9 @@ from typing import (
|
|||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.exceptions import (
|
from libp2p.network.stream.exceptions import (
|
||||||
StreamClosed,
|
StreamClosed,
|
||||||
)
|
)
|
||||||
@ -29,9 +32,6 @@ from libp2p.pubsub import (
|
|||||||
from libp2p.tools.async_service import (
|
from libp2p.tools.async_service import (
|
||||||
Service,
|
Service,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
from libp2p.utils import (
|
from libp2p.utils import (
|
||||||
encode_varint_prefixed,
|
encode_varint_prefixed,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -26,6 +26,9 @@ import trio
|
|||||||
from libp2p.crypto.keys import (
|
from libp2p.crypto.keys import (
|
||||||
PrivateKey,
|
PrivateKey,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.exceptions import (
|
from libp2p.exceptions import (
|
||||||
ParseError,
|
ParseError,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
@ -53,9 +56,6 @@ from libp2p.peer.id import (
|
|||||||
from libp2p.tools.async_service import (
|
from libp2p.tools.async_service import (
|
||||||
Service,
|
Service,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
from libp2p.utils import (
|
from libp2p.utils import (
|
||||||
encode_varint_prefixed,
|
encode_varint_prefixed,
|
||||||
read_varint_prefixed_bytes,
|
read_varint_prefixed_bytes,
|
||||||
|
|||||||
@ -11,6 +11,9 @@ from libp2p.crypto.pb import (
|
|||||||
from libp2p.crypto.serialization import (
|
from libp2p.crypto.serialization import (
|
||||||
deserialize_public_key,
|
deserialize_public_key,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.io.abc import (
|
from libp2p.io.abc import (
|
||||||
ReadWriteCloser,
|
ReadWriteCloser,
|
||||||
)
|
)
|
||||||
@ -38,9 +41,6 @@ from libp2p.security.exceptions import (
|
|||||||
from libp2p.security.secure_conn_interface import (
|
from libp2p.security.secure_conn_interface import (
|
||||||
ISecureConn,
|
ISecureConn,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .pb import (
|
from .pb import (
|
||||||
plaintext_pb2,
|
plaintext_pb2,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ from libp2p.crypto.keys import (
|
|||||||
KeyPair,
|
KeyPair,
|
||||||
PrivateKey,
|
PrivateKey,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.connection.raw_connection_interface import (
|
from libp2p.network.connection.raw_connection_interface import (
|
||||||
IRawConnection,
|
IRawConnection,
|
||||||
)
|
)
|
||||||
@ -14,9 +17,6 @@ from libp2p.security.secure_conn_interface import (
|
|||||||
from libp2p.security.secure_transport_interface import (
|
from libp2p.security.secure_transport_interface import (
|
||||||
ISecureTransport,
|
ISecureTransport,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .patterns import (
|
from .patterns import (
|
||||||
IPattern,
|
IPattern,
|
||||||
|
|||||||
@ -34,6 +34,9 @@ from libp2p.crypto.keys import (
|
|||||||
from libp2p.crypto.serialization import (
|
from libp2p.crypto.serialization import (
|
||||||
deserialize_public_key,
|
deserialize_public_key,
|
||||||
)
|
)
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.io.abc import (
|
from libp2p.io.abc import (
|
||||||
EncryptedMsgReadWriter,
|
EncryptedMsgReadWriter,
|
||||||
)
|
)
|
||||||
@ -57,9 +60,6 @@ from libp2p.security.secure_conn_interface import (
|
|||||||
from libp2p.security.secure_session import (
|
from libp2p.security.secure_session import (
|
||||||
SecureSession,
|
SecureSession,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
IncompatibleChoices,
|
IncompatibleChoices,
|
||||||
|
|||||||
@ -5,6 +5,9 @@ from collections import (
|
|||||||
OrderedDict,
|
OrderedDict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.connection.raw_connection_interface import (
|
from libp2p.network.connection.raw_connection_interface import (
|
||||||
IRawConnection,
|
IRawConnection,
|
||||||
)
|
)
|
||||||
@ -29,9 +32,6 @@ from libp2p.security.secure_transport_interface import (
|
|||||||
from libp2p.transport.typing import (
|
from libp2p.transport.typing import (
|
||||||
TSecurityOptions,
|
TSecurityOptions,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Represents a secured connection object, which includes a connection and details about
|
Represents a secured connection object, which includes a connection and details about
|
||||||
|
|||||||
@ -5,6 +5,9 @@ from typing import (
|
|||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.exceptions import (
|
from libp2p.exceptions import (
|
||||||
ParseError,
|
ParseError,
|
||||||
)
|
)
|
||||||
@ -24,9 +27,6 @@ from libp2p.stream_muxer.abc import (
|
|||||||
IMuxedConn,
|
IMuxedConn,
|
||||||
IMuxedStream,
|
IMuxedStream,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
from libp2p.utils import (
|
from libp2p.utils import (
|
||||||
decode_uvarint_from_stream,
|
decode_uvarint_from_stream,
|
||||||
encode_uvarint,
|
encode_uvarint,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ from collections import (
|
|||||||
OrderedDict,
|
OrderedDict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.connection.raw_connection_interface import (
|
from libp2p.network.connection.raw_connection_interface import (
|
||||||
IRawConnection,
|
IRawConnection,
|
||||||
)
|
)
|
||||||
@ -24,9 +27,6 @@ from libp2p.transport.typing import (
|
|||||||
TMuxerClass,
|
TMuxerClass,
|
||||||
TMuxerOptions,
|
TMuxerOptions,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .abc import (
|
from .abc import (
|
||||||
IMuxedConn,
|
IMuxedConn,
|
||||||
|
|||||||
@ -28,6 +28,9 @@ from libp2p.crypto.keys import (
|
|||||||
PrivateKey,
|
PrivateKey,
|
||||||
)
|
)
|
||||||
from libp2p.crypto.secp256k1 import create_new_key_pair as create_secp256k1_key_pair
|
from libp2p.crypto.secp256k1 import create_new_key_pair as create_secp256k1_key_pair
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.host.basic_host import (
|
from libp2p.host.basic_host import (
|
||||||
BasicHost,
|
BasicHost,
|
||||||
)
|
)
|
||||||
@ -121,9 +124,6 @@ from libp2p.transport.typing import (
|
|||||||
from libp2p.transport.upgrader import (
|
from libp2p.transport.upgrader import (
|
||||||
TransportUpgrader,
|
TransportUpgrader,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .constants import (
|
from .constants import (
|
||||||
FLOODSUB_PROTOCOL_ID,
|
FLOODSUB_PROTOCOL_ID,
|
||||||
|
|||||||
@ -6,6 +6,9 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.io.abc import (
|
from libp2p.io.abc import (
|
||||||
ReadWriteCloser,
|
ReadWriteCloser,
|
||||||
)
|
)
|
||||||
@ -15,9 +18,6 @@ from libp2p.security.secure_transport_interface import (
|
|||||||
from libp2p.stream_muxer.abc import (
|
from libp2p.stream_muxer.abc import (
|
||||||
IMuxedConn,
|
IMuxedConn,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
THandler = Callable[[ReadWriteCloser], Awaitable[None]]
|
THandler = Callable[[ReadWriteCloser], Awaitable[None]]
|
||||||
TSecurityOptions = Mapping[TProtocol, ISecureTransport]
|
TSecurityOptions = Mapping[TProtocol, ISecureTransport]
|
||||||
|
|||||||
1
newsfragments/500.internal.rst
Normal file
1
newsfragments/500.internal.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Rename ``typing.py`` to ``custom_types.py`` for clarity.
|
||||||
@ -1,6 +1,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import multiaddr
|
import multiaddr
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.network.stream.exceptions import (
|
from libp2p.network.stream.exceptions import (
|
||||||
StreamError,
|
StreamError,
|
||||||
)
|
)
|
||||||
@ -14,9 +17,6 @@ from libp2p.tools.utils import (
|
|||||||
connect,
|
connect,
|
||||||
create_echo_stream_handler,
|
create_echo_stream_handler,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
PROTOCOL_ID_0 = TProtocol("/echo/0")
|
PROTOCOL_ID_0 = TProtocol("/echo/0")
|
||||||
PROTOCOL_ID_1 = TProtocol("/echo/1")
|
PROTOCOL_ID_1 = TProtocol("/echo/1")
|
||||||
|
|||||||
@ -9,6 +9,9 @@ from p2pclient.utils import (
|
|||||||
)
|
)
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.peer.peerinfo import (
|
from libp2p.peer.peerinfo import (
|
||||||
PeerInfo,
|
PeerInfo,
|
||||||
info_from_p2p_addr,
|
info_from_p2p_addr,
|
||||||
@ -16,9 +19,6 @@ from libp2p.peer.peerinfo import (
|
|||||||
from libp2p.tools.factories import (
|
from libp2p.tools.factories import (
|
||||||
HostFactory,
|
HostFactory,
|
||||||
)
|
)
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
from tests.utils.interop.envs import (
|
from tests.utils.interop.envs import (
|
||||||
GO_BIN_PATH,
|
GO_BIN_PATH,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -14,6 +14,9 @@ from p2pclient import (
|
|||||||
)
|
)
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
|
from libp2p.custom_types import (
|
||||||
|
TProtocol,
|
||||||
|
)
|
||||||
from libp2p.peer.id import (
|
from libp2p.peer.id import (
|
||||||
ID,
|
ID,
|
||||||
)
|
)
|
||||||
@ -23,9 +26,6 @@ from libp2p.peer.peerinfo import (
|
|||||||
)
|
)
|
||||||
from libp2p.security.noise.transport import PROTOCOL_ID as NOISE_PROTOCOL_ID
|
from libp2p.security.noise.transport import PROTOCOL_ID as NOISE_PROTOCOL_ID
|
||||||
from libp2p.security.secio.transport import ID as SECIO_PROTOCOL_ID
|
from libp2p.security.secio.transport import ID as SECIO_PROTOCOL_ID
|
||||||
from libp2p.typing import (
|
|
||||||
TProtocol,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .constants import (
|
from .constants import (
|
||||||
LOCALHOST_IP,
|
LOCALHOST_IP,
|
||||||
|
|||||||
Reference in New Issue
Block a user