baseimage-tutorial-framework/lib/tfw/builtins/tfw_server_connector.py

26 lines
654 B
Python
Raw Normal View History

from tfw.networking import ServerUplinkConnector, ServerConnector
from tfw.config import TFWENV
class ConnAddrMixin:
@property
def uplink_conn_addr(self):
return f'tcp://localhost:{TFWENV.PULL_PORT}'
@property
def downlink_conn_addr(self):
return f'tcp://localhost:{TFWENV.PUB_PORT}'
class TFWServerUplinkConnector(ServerUplinkConnector, ConnAddrMixin):
def __init__(self):
super().__init__(self.uplink_conn_addr)
class TFWServerConnector(ServerConnector, ConnAddrMixin):
def __init__(self):
super().__init__(
self.downlink_conn_addr,
self.uplink_conn_addr
)