PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
xray
/
console_utils
/
__pycache__
� �%�i�) � �f � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z mZmZm Z mZmZmZ ddlmZ ddlmZ ej d� � Zd Zd Zdez dz ez d z ez dz Zdez dz Zdez dz Zdez ez ez dz Z ej dez dz ez dz ej � � ZdZ de!de"fd�Z#de!de"fd�Z$de!de!fd�Z% e d ee!d � d!�"� � ed#� � ee!d� � d$ ee!d%� d&�"� � ed'� � ee!d(� d)�"� � ed*� � e ee%� � e ed+�"� � � � ed,� � ee! e e d-�"� � � � ed.� � ee!e$d/�"� � ed0� � ee&d1� d2�"� � ed3� � ee&d4� d5�"� � ed6� � ee&d7� d8�"� � ed9� � ee"d� � ed:� � ee"d� � ed;� � ee"d� � i � � Z' e d ee!d<� d=�"� � ed#� � ee!d� � ed'� � ee!d>� d)�"� � ed*� � e ee%� � e ed+�"� � � � ed.� � ee!e$d/�"� � ed0� � ee&d?� d2�"� � ed3� � ee&d@� d5�"� � ed6� � ee&dA� d8�"� � i� � Z( e i edB� � ee!d� � � ed#� � ee!d� � �d ee!dC� d!�"� � � edD� � e ee!dE� dF�"� � d� � � edG� � e"� edH� � e"� edI� � ee!d� � � edJ� � ee!d� � � edK� � e"� edL� � e"� edM� � ee!d� � � edN� � ee!d� � � edO� � e!� edP� � e!� edQ� � e!� edR� � e"� edS� � ee!d� � � edT� � ee!d� � edU� � ee!d� � edV� � ee!d� � edW� � ee!d� � edX� � ee!d� � edY� � e! edZ� � e! ed[� � e!i�� � Z)d\e*d]e defd^�Z+d\e*defd_�Z,d\e*defd`�Z-d\e*defda�Z.dS )bzE This module contains functions for performing necessary validations � N)� Namespace)�urlparse)�Schema�And�Optional�Regex�SchemaError�Use�Or)�safe_id_pattern��read_sys_id�validationsu ¡-zI(?:25[0-5]|2[0-4]\d|[0-1]?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}z[a-zz0-9](?:[a-zz0-9-]{0,61}[a-zz0-9])?z(?:\.(?!-)[a-zz0-9-]{1,63}(?<!-))*z\.(?!-)(?:[a-zz%-]{2,63}|xn--[a-z0-9]{1,59})(?<!-)\.?�(z|localhost)z/^(?:http)s?://(?:[^\s:@/]+(?::[^\s:@/]*)?@)?(?:�|z )(?::\d{2,5})?(?:[/?#][^\s]*)?\Za� (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])�ipaddr�returnc � � t | t � � rdS t j | � � dS # t $ r Y dS w xY w)z� Checks if given IP address is a valid one :param ipaddr: IP address :return: True if IP address is valid, False otherwise FT)� isinstance�int� ipaddress� ip_address� ValueError�r s �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/console_utils/validations.py�is_ip_validr 8 sX � � �&�#��� ��u����V�$�$�$��t��� � � ��u�u����s �/ � =�=c � � t | t � � rdS | dk rdS t j | � � dS # t $ r Y dS w xY w)z� Checks if given IP address is a valid one for IPv4 '*' is also allowed :param ipaddr: IPv4 address :return: True if IPv4 address is valid, False otherwise F�*T)r r r �IPv4Addressr r s r � is_ipv4_validr G sf � � �&�#��� ��u� ��}�}��t����f�%�%�%��t��� � � ��u�u����s �7 � A�A�orig_urlc �<