HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/validators/__pycache__/hostname.cpython-311.pyc
�

�;f/����dZddlmZddlZddlmZddlmZddlmZm	Z	ddl
mZed	���Zed
���Z
defd�Zed
d
ddd
dd
d
d�dededededededeededefd���ZdS)z	Hostname.�)�	lru_cacheN)�Optional�)�domain)�ipv4�ipv6)�	validatorc�*�tjd��S)zPort validation regex.zZ^\:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3})$)�re�compile���F/opt/alt/python311/lib/python3.11/site-packages/validators/hostname.py�_port_regexrs���:�	<���rc�@�tjdtj��S)z!Simple hostname validation regex.z1^(?!-)[a-z0-9](?:[a-z0-9-]{0,59}[a-z0-9])?(?<!-)$)rr�
IGNORECASEr
rr�_simple_hostname_regexrs��
�:�J�B�M�Z�Z�Zr�valuec��|�d��dkre|�dd��\}}t���d|����r(|�d���d��S|�d��dkr?|�dd��\}}t���d|����r|SdS)z&Returns host segment if port is valid.z]:r�:�[�]N)�count�rsplitr�match�lstrip�rstrip)r�host_seg�port_segs   r�_port_validatorr  s����{�{�4���A���"�\�\�#�q�1�1���(��=�=���~�8�~�~�.�.�	4��?�?�3�'�'�.�.�s�3�3�3��{�{�3���1���"�\�\�#�q�1�1���(��=�=���~�8�~�~�.�.�	��O��4rFT)�skip_ipv6_addr�skip_ipv4_addr�
may_have_port�maybe_simple�consider_tld�private�rfc_1034�rfc_2782r!r"r#r$r%r&r'r(c��|sdS|rtt|��x}	rc|r!t���|	��ndp=t|	|||���p*|rdnt	|	d|���p|rdnt|	d���S|r!t���|��ndp=t||||���p*|rdnt	|d|���p|rdnt|d���S)a�Return whether or not given value is a valid hostname.

    Examples:
        >>> hostname("ubuntu-pc:443")
        # Output: True
        >>> hostname("this-pc")
        # Output: True
        >>> hostname("xn----gtbspbbmkef.xn--p1ai:65535")
        # Output: True
        >>> hostname("_example.com")
        # Output: True
        >>> hostname("123.5.77.88:31000")
        # Output: True
        >>> hostname("12.12.12.12")
        # Output: True
        >>> hostname("[::1]:22")
        # Output: True
        >>> hostname("dead:beef:0:0:0:0000:42:1")
        # Output: True
        >>> hostname("[0:0:0:0:0:ffff:1.2.3.4]:-65538")
        # Output: ValidationError(func=hostname, ...)
        >>> hostname("[0:&:b:c:@:e:f::]:9999")
        # Output: ValidationError(func=hostname, ...)

    Args:
        value:
            Hostname string to validate.
        skip_ipv6_addr:
            When hostname string cannot be an IPv6 address.
        skip_ipv4_addr:
            When hostname string cannot be an IPv4 address.
        may_have_port:
            Hostname string may contain port number.
        maybe_simple:
            Hostname string maybe only hyphens and alpha-numerals.
        consider_tld:
            Restrict domain to TLDs allowed by IANA.
        private:
            Embedded IP address is public if `False`, private/local if `True`.
        rfc_1034:
            Allow trailing dot in domain/host name.
            Ref: [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034).
        rfc_2782:
            Domain/Host name is of type service record.
            Ref: [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782).

    Returns:
        (Literal[True]): If `value` is a valid hostname.
        (ValidationError): If `value` is an invalid hostname.
    F)r%r'r()�cidrr&)r*)r rrrrr)
rr!r"r#r$r%r&r'r(rs
          r�hostnamer+1s9��@���u��
�o�e�&<�&<�<�(�
�9E�
P�
#�
%�
%�
+�
+�H�
5�
5�
5�5�
I��h�\�H�W_�`�`�`�
I�'�X���T�(��PW�-X�-X�-X�
I�(�G���T�(��-G�-G�-G�		
�3?�	I�	�	!�	!�	'�	'��	.�	.�	.�E�	B��%�l�X�PX�Y�Y�Y�	B�#�Q�E�E��e�%��)Q�)Q�)Q�	B�$�@�E�E��e�%�)@�)@�)@�	r)�__doc__�	functoolsrr�typingrr�
ip_addressrr�utilsr	rr�strr �boolr+r
rr�<module>r3s����� ������	�	�	�	�������������#�"�"�"�"�"�"�"��������������[�[���[��3�����"�
!� ����"���O�O�O��O��	O�
�O��
O��O��O��d�^�O��O��O�O�O���O�O�Or