Changeset e15970a in trunk
- Timestamp:
- 2023-03-29T13:26:59Z (2 years ago)
- Branches:
- master
- Children:
- c52eb69
- Parents:
- ed237b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/listeners.py ¶
red237b0 re15970a 65 65 into the Tahoe-LAFS node. 66 66 """ 67 68 class TCPProvider: 69 """ 70 Support plain TCP connections. 71 """ 72 def is_available(self) -> Literal[True]: 73 return True 74 75 def can_hide_ip(self) -> Literal[False]: 76 return False 77 78 async def create_config(self, reactor: Any, cli_config: Any) -> ListenerConfig: 79 tub_ports = [] 80 tub_locations = [] 81 if cli_config["port"]: # --port/--location are a pair 82 tub_ports.append(cli_config["port"]) 83 tub_locations.append(cli_config["location"]) 84 else: 85 assert "hostname" in cli_config 86 hostname = cli_config["hostname"] 87 new_port = allocate_tcp_port() 88 tub_ports.append(f"tcp:{new_port}") 89 tub_locations.append(f"tcp:{hostname}:{new_port}") 90 91 return ListenerConfig(tub_ports, tub_locations, {}) 92 93 def create(self, reactor: Any, config: Any) -> IAddressFamily: 94 raise NotImplementedError() 95 96 97 @define 98 class StaticProvider: 99 """ 100 A provider that uses all pre-computed values. 101 """ 102 _available: bool 103 _hide_ip: bool 104 _config: Any 105 _address: IAddressFamily 106 107 def is_available(self) -> bool: 108 return self._available 109 110 def can_hide_ip(self) -> bool: 111 return self._hide_ip 112 113 async def create_config(self, reactor: Any, cli_config: Any) -> None: 114 return await self._config 115 116 def create(self, reactor: Any, config: Any) -> IAddressFamily: 117 return self._address
Note: See TracChangeset
for help on using the changeset viewer.