From b98025c3791f409b088187c010086db641199351 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Fri, 2 Aug 2019 14:50:20 -0700 Subject: [PATCH] Move security transports into their respective sub-packages --- .../{insecure_security.py => insecure/transport.py} | 3 +-- libp2p/security/secio/__init__.py | 0 .../security/{simple_security.py => simple/transport.py} | 3 +-- tests/security/test_security_multistream.py | 9 ++++----- 4 files changed, 6 insertions(+), 9 deletions(-) rename libp2p/security/{insecure_security.py => insecure/transport.py} (97%) create mode 100644 libp2p/security/secio/__init__.py rename libp2p/security/{simple_security.py => simple/transport.py} (98%) diff --git a/libp2p/security/insecure_security.py b/libp2p/security/insecure/transport.py similarity index 97% rename from libp2p/security/insecure_security.py rename to libp2p/security/insecure/transport.py index ce3f018..7e1b77e 100644 --- a/libp2p/security/insecure_security.py +++ b/libp2p/security/insecure/transport.py @@ -4,8 +4,7 @@ from libp2p.network.connection.raw_connection_interface import IRawConnection from libp2p.peer.id import ID from libp2p.security.secure_conn_interface import ISecureConn from libp2p.security.secure_transport_interface import ISecureTransport - -from .typing import TSecurityDetails +from libp2p.security.typing import TSecurityDetails class InsecureTransport(ISecureTransport): diff --git a/libp2p/security/secio/__init__.py b/libp2p/security/secio/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/libp2p/security/simple_security.py b/libp2p/security/simple/transport.py similarity index 98% rename from libp2p/security/simple_security.py rename to libp2p/security/simple/transport.py index 4fb0a3c..8860ab5 100644 --- a/libp2p/security/simple_security.py +++ b/libp2p/security/simple/transport.py @@ -5,8 +5,7 @@ from libp2p.network.connection.raw_connection_interface import IRawConnection from libp2p.peer.id import ID from libp2p.security.secure_conn_interface import ISecureConn from libp2p.security.secure_transport_interface import ISecureTransport - -from .typing import TSecurityDetails +from libp2p.security.typing import TSecurityDetails class SimpleSecurityTransport(ISecureTransport): diff --git a/tests/security/test_security_multistream.py b/tests/security/test_security_multistream.py index 070f29d..6abf534 100644 --- a/tests/security/test_security_multistream.py +++ b/tests/security/test_security_multistream.py @@ -1,13 +1,12 @@ import asyncio -import multiaddr -import pytest - from libp2p import new_node from libp2p.peer.peerinfo import info_from_p2p_addr from libp2p.protocol_muxer.multiselect_client import MultiselectClientError -from libp2p.security.insecure_security import InsecureTransport -from libp2p.security.simple_security import SimpleSecurityTransport +from libp2p.security.insecure.transport import InsecureTransport +from libp2p.security.simple.transport import SimpleSecurityTransport +import multiaddr +import pytest from tests.utils import cleanup, connect # TODO: Add tests for multiple streams being opened on different