From f4394436a5c78965a70fe3d2424c72d471efe85c Mon Sep 17 00:00:00 2001 From: rafa-be Date: Mon, 2 Sep 2024 14:36:52 +0200 Subject: [PATCH] Removes security warning when creating a server socket on 0.0.0.0. Signed-off-by: rafa-be --- parfun/about.py | 2 +- parfun/backend/utility.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parfun/about.py b/parfun/about.py index a3e63b6..65422e9 100644 --- a/parfun/about.py +++ b/parfun/about.py @@ -1 +1 @@ -__version__ = "6.0.7" +__version__ = "6.0.8" diff --git a/parfun/backend/utility.py b/parfun/backend/utility.py index 39e8fb2..74d6d2f 100644 --- a/parfun/backend/utility.py +++ b/parfun/backend/utility.py @@ -1,7 +1,7 @@ import socket -def get_available_tcp_port() -> int: +def get_available_tcp_port(hostname: str = "127.0.0.1") -> int: with socket.socket(socket.AddressFamily.AF_INET, socket.SocketKind.SOCK_STREAM) as sock: - sock.bind(("0.0.0.0", 0)) + sock.bind((hostname, 0)) return sock.getsockname()[1]