2019-04-28 07:42:05 +08:00
|
|
|
from abc import ABC, abstractmethod
|
2019-08-01 19:12:11 +08:00
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
2019-08-02 14:12:59 +08:00
|
|
|
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
2019-08-01 19:12:11 +08:00
|
|
|
from .typing import TSecurityDetails
|
|
|
|
|
2019-05-02 01:54:19 +08:00
|
|
|
|
2019-04-28 07:42:05 +08:00
|
|
|
"""
|
|
|
|
Represents a secured connection object, which includes a connection and details about the security
|
|
|
|
involved in the secured connection
|
|
|
|
|
|
|
|
Relevant go repo: https://github.com/libp2p/go-conn-security/blob/master/interface.go
|
|
|
|
"""
|
|
|
|
|
2019-08-01 06:00:12 +08:00
|
|
|
|
|
|
|
class ISecureConn(ABC):
|
2019-04-28 07:42:05 +08:00
|
|
|
@abstractmethod
|
2019-08-02 14:12:59 +08:00
|
|
|
def get_conn(self) -> "IRawConnection":
|
2019-04-28 07:42:05 +08:00
|
|
|
"""
|
2019-08-02 14:12:59 +08:00
|
|
|
:return: the underlying raw connection
|
2019-04-28 07:42:05 +08:00
|
|
|
"""
|
|
|
|
|
2019-04-30 06:05:38 +08:00
|
|
|
@abstractmethod
|
2019-08-01 19:12:11 +08:00
|
|
|
def get_security_details(self) -> "TSecurityDetails":
|
2019-04-28 07:42:05 +08:00
|
|
|
"""
|
|
|
|
:return: map containing details about the connections security
|
|
|
|
"""
|