From 94bb7abfd217effe60a16b2e4002f3784f55b427 Mon Sep 17 00:00:00 2001 From: Zxilly Date: Wed, 27 Nov 2024 14:05:25 +0800 Subject: [PATCH] test: enable ipv6 and disable log --- scripts/test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/test.py b/scripts/test.py index c43628b..ea9a9ca 100644 --- a/scripts/test.py +++ b/scripts/test.py @@ -36,9 +36,12 @@ async def root(request: Request): return Response(content=str(len(user_agent)).encode()) def start_server(): - config = Config(app=app, host="0.0.0.0", port=PORT) - server = Server(config) - server.run() + config4 = Config(app=app, host="127.0.0.1", port=PORT, access_log=False) + config6 = Config(app=app, host="::1", port=PORT, access_log=False) + server4 = Server(config4) + server6 = Server(config6) + threading.Thread(target=server4.run).start() + threading.Thread(target=server6.run).start() def start_ua2f(u: str): p = subprocess.Popen([u]) @@ -66,9 +69,7 @@ if __name__ == "__main__": setup_iptables() - server = threading.Thread(target=start_server) - server.daemon = True - server.start() + start_server() ua2f_thread = threading.Thread(target=start_ua2f, args=(ua2f,)) ua2f_thread.daemon = True