o
    j                     @   s*   d dl Z d	ddZd	ddZd
ddZdS )    Nc                    H   t jt j| ||dgddiI dH }t|d tr |d S |d )a6  
	Helper function to read exactly N amount of data from the wire.
	:param reader: The reader object
	:type reader: asyncio.StreamReader
	:param n: The maximum amount of bytes to read.
	:type n: int
	:param timeout: Time in seconds to wait for the reader to return data
	:type timeout: int
	:return: bytearray
	timeoutreturn_exceptionsTNr   )asynciogatherwait_forreadexactly
isinstancebytesreadernr   temp r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/asysocks/common/aiowrappers.pyreadexactly_or_exc   s
   (r   c                    r   )ak  
	Helper function to read N amount of data from the wire.
	:param reader: The reader object
	:type reader: asyncio.StreamReader
	:param n: The maximum amount of bytes to read. BEWARE: this only sets an upper limit of the data to be read
	:type n: int
	:param timeout: Time in seconds to wait for the reader to return data
	:type timeout: int
	:return: bytearray
	r   r   TNr   )r   r   r   readr
   r   r   r   r   r   read_or_exc   
   (r      
c                    r   )aj  
	Helper function to read stream until separator is hit.
	:param reader: The reader object
	:type reader: asyncio.StreamReader
	:param n: The maximum amount of bytes to read. BEWARE: this only sets an upper limit of the data to be read
	:type n: int
	:param timeout: Time in seconds to wait for the reader to return data
	:type timeout: int
	:return: bytearray
	r   r   TNr   )r   r   r   	readuntilr
   r   )r   	separatorr   r   r   r   r   readuntil_or_exc'   r   r   )N)r   N)r   r   r   r   r   r   r   r   <module>   s    

