qmi.core.util.parse_address_and_port

qmi.core.util.parse_address_and_port(address: str) tuple[str, int]

Parse host address and port number.

The host address may either be an IP address or a host name.

Parameters:

address – String in format "<host>:<port>" where <host> is either a host name or an IPv4 or IPv6 address, and <port> is a decimal TCP/UDP port number. If <host> is an IPv6 address, it must be enclosed in square brackets (e.g. “[::1]:5001”) to avoid ambiguous interpretation of the : symbol.

Returns:

Tuple (host, port).

Raises:

ValueError – If an invalid address format is detected.