akkudoktoreos.server.server.validate_ip_or_hostname
- akkudoktoreos.server.server.validate_ip_or_hostname(value: str) str
Validate whether a string is a valid IP address (IPv4 or IPv6) or hostname.
This function first attempts to interpret the input as an IP address using the standard library ipaddress module. If that fails, it checks whether the input is a valid hostname according to RFC 1123, which allows domain names consisting of alphanumeric characters and hyphens, with specific length and structure rules.
- Parameters:
value (str) – The input string to validate.
- Returns:
Valid IP address or hostname.
- Return type:
IP address