(self, event: events.MessageInjected)
| 313 | return [addr for server in self.servers for addr in server.listen_addrs] |
| 314 | |
| 315 | def inject_event(self, event: events.MessageInjected): |
| 316 | connection_id: str | tuple |
| 317 | if event.flow.client_conn.transport_protocol != "udp": |
| 318 | connection_id = event.flow.client_conn.id |
| 319 | else: # pragma: no cover |
| 320 | # temporary workaround: for UDP we don't have persistent client IDs yet. |
| 321 | connection_id = ( |
| 322 | event.flow.client_conn.peername, |
| 323 | event.flow.client_conn.sockname, |
| 324 | ) |
| 325 | if connection_id not in self.connections: |
| 326 | raise ValueError("Flow is not from a live connection.") |
| 327 | |
| 328 | asyncio_utils.create_task( |
| 329 | self.connections[connection_id].server_event(event), |
| 330 | name=f"inject_event", |
| 331 | keep_ref=True, |
| 332 | client=event.flow.client_conn.peername, |
| 333 | ) |
| 334 | |
| 335 | @command.command("inject.websocket") |
| 336 | def inject_websocket( |
no test coverage detected