mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-10-31 13:12:56 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			642 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			642 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from tfw.networking import ServerConnector, ServerUplinkConnector
 | |
| 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 TFWUplinkConnector(ServerUplinkConnector, ConnAddrMixin):
 | |
|     def __init__(self):
 | |
|         super().__init__(self.uplink_conn_addr)
 | |
| 
 | |
| 
 | |
| class TFWConnector(ServerConnector, ConnAddrMixin):
 | |
|     def __init__(self):
 | |
|         super().__init__(
 | |
|             self.downlink_conn_addr,
 | |
|             self.uplink_conn_addr
 | |
|         )
 |