# x-run: cd .. && python -m bta_proxy '201:4f8c:4ea:0:71ec:6d7:6f1b:a4f9' import asyncio from argparse import ArgumentParser, Namespace from bta_proxy.proxy import BTAProxy parser = ArgumentParser("bta_proxy", description="Better Than Adventure proxy with Deep Packet Inspection") parser.add_argument("remote_host", type=str) parser.add_argument("remote_port", type=int, default=25565) parser.add_argument("--bind", type=str, default="127.0.0.1") parser.add_argument("--bind-port", type=int, default=25565) async def main(args: Namespace): loop = asyncio.get_running_loop() proxy = BTAProxy(args.remote_host, args.remote_port, loop) server = await asyncio.start_server(proxy.handle_client, args.bind, args.bind_port) print("listening on", str.join(", ", [str(s.getsockname()) for s in server.sockets])) print("forwarding to", args.remote_host, args.remote_port) async with server: await server.serve_forever() if __name__ == '__main__': asyncio.run(main(parser.parse_args()))