Lines 2040-2052
Link Here
|
2040 |
# Function to monkeypatch zeroconf to remove the 15 character name length restriction. |
2040 |
# Function to monkeypatch zeroconf to remove the 15 character name length restriction. |
2041 |
# Copied from https://github.com/jstasiak/python-zeroconf version 0.28.1 |
2041 |
# Copied from https://github.com/jstasiak/python-zeroconf version 0.28.1 |
2042 |
|
2042 |
|
2043 |
|
|
|
2044 |
from zeroconf import (BadTypeInNameException, _HAS_A_TO_Z, |
2045 |
_HAS_ONLY_A_TO_Z_NUM_HYPHEN_UNDERSCORE, |
2046 |
_HAS_ASCII_CONTROL_CHARS, |
2047 |
_HAS_ONLY_A_TO_Z_NUM_HYPHEN) |
2048 |
|
2049 |
|
2050 |
def service_type_name(type_: str, *, allow_underscores: bool = False) -> str: |
2043 |
def service_type_name(type_: str, *, allow_underscores: bool = False) -> str: |
2051 |
""" |
2044 |
""" |
2052 |
Validate a fully qualified service name, instance or subtype. [rfc6763] |
2045 |
Validate a fully qualified service name, instance or subtype. [rfc6763] |
Lines 2087-2092
Link Here
|
2087 |
:param type_: Type, SubType or service name to validate |
2080 |
:param type_: Type, SubType or service name to validate |
2088 |
:return: fully qualified service name (eg: _http._tcp.local.) |
2081 |
:return: fully qualified service name (eg: _http._tcp.local.) |
2089 |
""" |
2082 |
""" |
|
|
2083 |
|
2084 |
from zeroconf import (BadTypeInNameException, _HAS_A_TO_Z, |
2085 |
_HAS_ONLY_A_TO_Z_NUM_HYPHEN_UNDERSCORE, |
2086 |
_HAS_ASCII_CONTROL_CHARS, |
2087 |
_HAS_ONLY_A_TO_Z_NUM_HYPHEN) |
2088 |
|
2090 |
if not (type_.endswith('._tcp.local.') or type_.endswith('._udp.local.')): |
2089 |
if not (type_.endswith('._tcp.local.') or type_.endswith('._udp.local.')): |
2091 |
raise BadTypeInNameException("Type '%s' must end with '._tcp.local.' or '._udp.local.'" % type_) |
2090 |
raise BadTypeInNameException("Type '%s' must end with '._tcp.local.' or '._udp.local.'" % type_) |
2092 |
|
2091 |
|