dolor.proxies.proxy

class ClientProxyConnection(proxy, reader, writer)[source]

Bases: dolor.connection.Connection

async write_packet(*args, **kwargs)[source]

Writes a packet.

Parameters
  • packet (subclass of Packet or Packet) –

    If a subclass of Packet, then the packet to write will be created by forwarding packet and **kwargs to the create_packet() method. Otherwise, packet is the packet to write.

    packet being a subclass of Packet is preferred so that the packet is created with the correct context for the connection.

  • **kwargs – The packet attributes to set and their corresponding values. Only able to be passed if packet is a subclass of Packet.

Returns

The written packet.

Return type

Packet

Raises

TypeError – If **kwargs is passed but packet isn’t a subclass of Packet.

close()[source]

Closes the connection.

Should be used alongside the wait_closed() method.

class ServerProxyConnection(proxy, client, reader, writer)[source]

Bases: dolor.connection.Connection

async write_packet(*args, **kwargs)[source]

Writes a packet.

Parameters
  • packet (subclass of Packet or Packet) –

    If a subclass of Packet, then the packet to write will be created by forwarding packet and **kwargs to the create_packet() method. Otherwise, packet is the packet to write.

    packet being a subclass of Packet is preferred so that the packet is created with the correct context for the connection.

  • **kwargs – The packet attributes to set and their corresponding values. Only able to be passed if packet is a subclass of Packet.

Returns

The written packet.

Return type

Packet

Raises

TypeError – If **kwargs is passed but packet isn’t a subclass of Packet.

close()[source]

Closes the connection.

Should be used alongside the wait_closed() method.

class Proxy(server_address, server_port=25565, *, lang_file=None, host_address='localhost', host_port=25565, auth=None)[source]

Bases: dolor.packet_handler.PacketHandler

session_server = 'https://sessionserver.mojang.com/session/minecraft'
ClientConnection

alias of dolor.proxies.proxy.ClientProxyConnection

ServerConnection

alias of dolor.proxies.proxy.ServerProxyConnection

register_packet_listener(func, *checkers, bound=None, outgoing=False)[source]

Registers a packet listener.

Parameters
  • func (coroutine function) – The packet listener.

  • *checkers (subclass of Packet or int or function) –

    If a subclass of Packet, then the listener will be called if the packet is an instance of that class.

    If an int, then the listener will be called if the id of the packet is equal to the passed int.

    If a function, then the function can either return a bool and take one argument, which represents the packet to check, or it can return a bool and take two arguments, the first being the relevant Connection, and the second being the packet to check.

  • **kwargs – Keyword arguments that must match the keyword arguments passed to listeners_for_packet() for the packet listener to be included in its return.

Raises
  • TypeError – If func isn’t a coroutine function.

  • ValueError – If no checkers are specified.

async listen_to_packet(c, s, p, *, bound, outgoing)[source]
async listen(c, s)[source]
async new_connection(c_reader, c_writer)[source]
is_serving()[source]
close()[source]
async wait_closed()[source]
async startup()[source]
async on_start()[source]
async start()[source]
run()[source]
async send_server_hash(c, server_hash)[source]