jlirochon / rakpy

Pythonic implementation of the RakNet protocol
6 stars 1 forks source link

rakpy

Pythonic implementation of the RakNet protocol WORK IN PROGRESS

Status

Build Status Code Coverage Code Quality Chat

Compatibility

Python 3.5, 3.4, 3.3 Python 2.7

Project goals

Usage

Decoding packets

In [1]: from rakpy.protocol import decode_packet

In [2]: buffer = b"\x01\x00\ (...) \x23\xa3"  # data from UDP packet

In [3]: packet = decode_packet(buffer)

In [4]: print packet
UnconnectedPing(time=193351, client_guid=1450258689827747)

In [5]: packet.time
193351

In [6]: packet.client_guid
1450258689827747

Encoding packets (not implemented yet)

In [1]: from rakpy.protocol.packets import UnconnectedPing

In [2]: packet = UnconnectedPong(ping_time=193351, server_guid=1450258689827742)

In [3]: packet.encode()
b"\x1c\x00\ (...) \x23\xa3"  # you can send this over UDP