Example that starts the REPL through an SSH server.
(port: int = 8222)
| 34 | |
| 35 | |
| 36 | async def main(port: int = 8222) -> None: |
| 37 | """ |
| 38 | Example that starts the REPL through an SSH server. |
| 39 | """ |
| 40 | # Namespace exposed in the REPL. |
| 41 | environ = {"hello": "world"} |
| 42 | |
| 43 | # Start SSH server. |
| 44 | def create_server() -> MySSHServer: |
| 45 | return MySSHServer(lambda: environ) |
| 46 | |
| 47 | print(f"Listening on: {port}") |
| 48 | print(f'To connect, do "ssh localhost -p {port}"') |
| 49 | |
| 50 | await asyncssh.create_server( |
| 51 | create_server, "", port, server_host_keys=["/etc/ssh/ssh_host_dsa_key"] |
| 52 | ) |
| 53 | await asyncio.Future() # Wait forever. |
| 54 | |
| 55 | |
| 56 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected