# Path: pydnstest/mock_client.py
# SOCKET_OPERATION_TIMEOUT = 5
# RECEIVE_MESSAGE_SIZE = 2**16-1
# THROTTLE_BY = 0.1
# def handle_socket_timeout(sock: socket.socket, deadline: float):
# def recv_n_bytes_from_tcp(stream: socket.socket, n: int, deadline: float) -> bytes:
# def recvfrom_blob(sock: socket.socket,
#                   timeout: int = SOCKET_OPERATION_TIMEOUT) -> Tuple[bytes, str]:
# def recvfrom_msg(sock: socket.socket,
#                  timeout: int = SOCKET_OPERATION_TIMEOUT) -> Tuple[dns.message.Message, str]:
# def sendto_msg(sock: socket.socket, message: bytes, addr: Optional[str] = None) -> None:
# def setup_socket(address: str,
#                  port: int,
#                  tcp: bool = False,
#                  src_address: str = None) -> socket.socket:
# def send_query(sock: socket.socket, query: Union[dns.message.Message, bytes]) -> None:
# def get_answer(sock: socket.socket, timeout: int = SOCKET_OPERATION_TIMEOUT) -> bytes:
# def get_dns_message(sock: socket.socket,
#                     timeout: int = SOCKET_OPERATION_TIMEOUT) -> dns.message.Message:


import sys
import dns.message
from pydnstest import mock_client
#!/usr/bin/python3



q = dns.message.make_query("anything", "A")
qid = q.id.to_bytes(2, "big", signed=False)
sock = mock_client.setup_socket("1.2.3.4", 53)
mock_client.send_query(sock, q)

# Path: pydnstest/mock_client.py
# SOCKET_OPERATION_TIMEOUT = 5
# RECEIVE_MESSAGE_SIZE = 2**16-1
# THROTTLE_BY = 0.1
# def handle_socket_timeout(sock: socket.socket, deadline: float):
# def recv_n_bytes_from_tcp(stream: socket.socket, n: int, deadline: float) -> bytes:
# def recvfrom_blob(sock: socket.socket,
#                   timeout: int = SOCKET_OPERATION_TIMEOUT) -> Tuple[bytes, str]:
# def recvfrom_msg(sock: socket.socket,
#                  timeout: int = SOCKET_OPERATION_TIMEOUT) -> Tuple[dns.message.Message, str]:
# def sendto_msg(sock: socket.socket, message: bytes, addr: Optional[str] = None) -> None:
# def setup_socket(address: str,
#                  port: int,
#                  tcp: bool = False,
#                  src_address: str = None) -> socket.socket:
# def send_query(sock: socket.socket, query: Union[dns.message.Message, bytes]) -> None:
# def get_answer(sock: socket.socket, timeout: int = SOCKET_OPERATION_TIMEOUT) -> bytes:
# def get_dns_message(sock: socket.socket,
#                     timeout: int = SOCKET_OPERATION_TIMEOUT) -> dns.message.Message:


# Path: ci/raw_id.py
import sys
import dns.message
from pydnstest import mock_client

#!/usr/bin/python3



q = dns.message.make_query("anything", "A")
qid = q.id.to_bytes(2, "big", signed=False)
sock = mock_client.setup_socket("1.2.3.4", 53)
mock_client.send_query(sock, q)

a = mock_client.get_answer(sock)