mcipc.query.proto package
Submodules
mcipc.query.proto.basic_stats module
Basic statistics protocol.
- class mcipc.query.proto.basic_stats.BasicStats(type: Type, session_id: BigEndianSignedInt32, motd: str, game_type: str, map: str, num_players: int, max_players: int, host_port: int, host_ip: IPAddressOrHostname)
Bases:
NamedTuple
Basic statistics response packet.
- game_type: str
Alias for field number 3
- host_ip: IPv4Address | IPv6Address | str
Alias for field number 8
- host_port: int
Alias for field number 7
- keys()
- map: str
Alias for field number 4
- max_players: int
Alias for field number 6
- motd: str
Alias for field number 2
- num_players: int
Alias for field number 5
- classmethod read(file: IO) BasicStats
Reads the basic stats from a file-like object.
- session_id: BigEndianSignedInt32
Alias for field number 1
- class mcipc.query.proto.basic_stats.Request(magic: bytes = b'\xfe\xfd', type: Type = Type.STAT, session_id: BigEndianSignedInt32 = 0, challenge_token: BigEndianSignedInt32 = 0)
Bases:
NamedTuple
Basic statistics request packet.
- challenge_token: BigEndianSignedInt32
Alias for field number 3
- classmethod create(challenge_token: BigEndianSignedInt32) Request
Creates a new request with the given challenge token.
- magic: bytes
Alias for field number 0
- session_id: BigEndianSignedInt32
Alias for field number 2
mcipc.query.proto.common module
Common protocol stuff.
- class mcipc.query.proto.common.BigEndianSignedInt32(*_)
Bases:
int
A big-endian, signed int32.
- MAX = 2147483647
- MIN = -2147483648
- classmethod from_bytes(bytes_: bytes) BigEndianSignedInt32
Returns the int from the given bytes.
- classmethod read(file: IO) BigEndianSignedInt32
Reads a big endian int32 from a file-like object.
- mcipc.query.proto.common.decode_all(blocks: Iterable[bytes], encoding='latin-1') Iterator[str]
Decodes all byte blocks with the given encoding.
- mcipc.query.proto.common.ip_or_hostname(string: str) IPv4Address | IPv6Address | str
Returns an IPv4 or IPv6 address if applicable, else a string.
- mcipc.query.proto.common.random_session_id() BigEndianSignedInt32
Returns a random session ID. See: https://wiki.vg/Query#Generating_a_Session_ID
mcipc.query.proto.full_stats module
Full statistics protocol.
- class mcipc.query.proto.full_stats.FullStats(type: Type, session_id: BigEndianSignedInt32, host_name: str, game_type: str, game_id: str, version: str, plugins: dict, map: str, num_players: int, max_players: int, host_port: int, host_ip: IPAddressOrHostname, players: list[str])
Bases:
NamedTuple
Full statistics response.
- game_id: str
Alias for field number 4
- game_type: str
Alias for field number 3
- host_ip: IPv4Address | IPv6Address | str
Alias for field number 11
- host_name: str
Alias for field number 2
- host_port: int
Alias for field number 10
- keys()
- map: str
Alias for field number 7
- max_players: int
Alias for field number 9
- num_players: int
Alias for field number 8
- players: list[str]
Alias for field number 12
- plugins: dict
Alias for field number 6
- session_id: BigEndianSignedInt32
Alias for field number 1
- version: str
Alias for field number 5
- class mcipc.query.proto.full_stats.Request(magic: bytes = b'\xfe\xfd', type: Type = Type.STAT, session_id: BigEndianSignedInt32 = 0, challenge_token: BigEndianSignedInt32 = 0, padding: bytes = b'\x00\x00\x00\x00')
Bases:
NamedTuple
Basic statistics request packet.
- challenge_token: BigEndianSignedInt32
Alias for field number 3
- classmethod create(challenge_token: BigEndianSignedInt32) Request
Creates a new request with the given challenge token.
- magic: bytes
Alias for field number 0
- padding: bytes
Alias for field number 4
- session_id: BigEndianSignedInt32
Alias for field number 2
mcipc.query.proto.handshake module
Handshake protocol.
- class mcipc.query.proto.handshake.Request(magic: bytes = b'\xfe\xfd', type: Type = Type.HANDSHAKE, session_id: BigEndianSignedInt32 = 0)
Bases:
NamedTuple
A client → server handshake request packet.
- magic: bytes
Alias for field number 0
- session_id: BigEndianSignedInt32
Alias for field number 2
- class mcipc.query.proto.handshake.Response(type: bytes, session_id: BigEndianSignedInt32, challenge_token: BigEndianSignedInt32)
Bases:
NamedTuple
A server → client handshake response packet.
- challenge_token: BigEndianSignedInt32
Alias for field number 2
- session_id: BigEndianSignedInt32
Alias for field number 1
- to_json() dict
Returns a JSON-ish dict.
- type: bytes
Alias for field number 0
Module contents
Low-level protocol stuff.
- class mcipc.query.proto.BasicStats(type: Type, session_id: BigEndianSignedInt32, motd: str, game_type: str, map: str, num_players: int, max_players: int, host_port: int, host_ip: IPAddressOrHostname)
Bases:
NamedTuple
Basic statistics response packet.
- game_type: str
Alias for field number 3
- host_ip: IPv4Address | IPv6Address | str
Alias for field number 8
- host_port: int
Alias for field number 7
- keys()
- map: str
Alias for field number 4
- max_players: int
Alias for field number 6
- motd: str
Alias for field number 2
- num_players: int
Alias for field number 5
- classmethod read(file: IO) BasicStats
Reads the basic stats from a file-like object.
- session_id: BigEndianSignedInt32
Alias for field number 1
- class mcipc.query.proto.BigEndianSignedInt32(*_)
Bases:
int
A big-endian, signed int32.
- MAX = 2147483647
- MIN = -2147483648
- classmethod from_bytes(bytes_: bytes) BigEndianSignedInt32
Returns the int from the given bytes.
- classmethod read(file: IO) BigEndianSignedInt32
Reads a big endian int32 from a file-like object.
- class mcipc.query.proto.FullStats(type: Type, session_id: BigEndianSignedInt32, host_name: str, game_type: str, game_id: str, version: str, plugins: dict, map: str, num_players: int, max_players: int, host_port: int, host_ip: IPAddressOrHostname, players: list[str])
Bases:
NamedTuple
Full statistics response.
- game_id: str
Alias for field number 4
- game_type: str
Alias for field number 3
- host_ip: IPv4Address | IPv6Address | str
Alias for field number 11
- host_name: str
Alias for field number 2
- host_port: int
Alias for field number 10
- keys()
- map: str
Alias for field number 7
- max_players: int
Alias for field number 9
- num_players: int
Alias for field number 8
- players: list[str]
Alias for field number 12
- plugins: dict
Alias for field number 6
- session_id: BigEndianSignedInt32
Alias for field number 1
- version: str
Alias for field number 5
- class mcipc.query.proto.Response(type: bytes, session_id: BigEndianSignedInt32, challenge_token: BigEndianSignedInt32)
Bases:
NamedTuple
A server → client handshake response packet.
- challenge_token: BigEndianSignedInt32
Alias for field number 2
- session_id: BigEndianSignedInt32
Alias for field number 1
- to_json() dict
Returns a JSON-ish dict.
- type: bytes
Alias for field number 0