Clarify network target parsing (#285)

This commit is contained in:
l5y
2025-10-11 20:38:40 +02:00
committed by GitHub
parent 9be390ee09
commit 1316d4f2d1
+6 -2
View File
@@ -215,10 +215,14 @@ def _parse_ble_target(value: str) -> str | None:
def _parse_network_target(value: str) -> tuple[str, int] | None:
"""Return ``(host, port)`` when ``value`` is an IP address string.
"""Return ``(host, port)`` when ``value`` is a numeric IP address string.
Only literal IPv4 or IPv6 addresses are accepted, optionally paired with a
port or scheme. Callers that start from hostnames should resolve them to an
address before invoking this helper.
Parameters:
value: Hostname or URL describing the TCP interface.
value: Numeric IP literal or URL describing the TCP interface.
Returns:
A ``(host, port)`` tuple or ``None`` when parsing fails.