py-libp2p/transport/upgrader.py

28 lines
655 B
Python
Raw Normal View History

2018-11-12 08:37:07 +08:00
from muxer.mplex.muxed_connection import MuxedConn
2018-11-13 02:02:49 +08:00
class TransportUpgrader():
2018-11-11 22:56:44 +08:00
def __init__(self, secOpt, muxerOpt):
self.sec = secOpt
self.muxer = muxerOpt
2018-11-11 22:56:44 +08:00
def upgrade_listener(self, transport, listeners):
"""
upgrade multiaddr listeners to libp2p-transport listeners
2018-11-11 22:56:44 +08:00
"""
pass
2018-11-13 02:02:49 +08:00
def upgrade_security(self):
pass
2018-11-11 22:56:44 +08:00
2018-11-12 08:37:07 +08:00
def upgrade_connection(self, conn, initiator):
"""
upgrade raw connection to muxed connection
"""
2018-11-13 02:02:49 +08:00
# For PoC, no security, default to mplex
2018-11-12 08:37:07 +08:00
# TODO do exchange to determine multiplexer
return MuxedConn(conn, initiator)