A high-performance relay server designed to facilitate peer-to-peer connections between clients using a simple binary protocol.
- 🚀 Ultra-fast C implementation using epoll
- 🔄 Simple binary protocol
- ⏱️ Automatic connection timeouts
- 🔒 No external dependencies
- 💻 Cross-platform (Linux/Unix)
-
Clone the repository:
git clone https://github.com/yourusername/cheery.git cd cheery -
Build the server:
make
-
Run the server:
./build/main
The server will listen on 0.0.0.0:8765 by default.
All packets start with a 1-byte command followed by optional payload.
Create a new room with a 4-byte room code.
[0x01][code:4]
Join an existing room with a 4-byte room code.
[0x02][code:4]
Responses:
0x04- Matched with peer0x05- Waiting for peer
Send data to the paired peer.
[0x03][data...]
{
"type": "get_ip",
"target": "username_to_query"
}-
User List Update (sent to all clients when user list changes):
{ "type": "user_list", "users": ["user1", "user2"] } -
IP Response (response to get_ip request):
{ "type": "ip_response", "target": "queried_username", "ip": "192.168.1.100" }or if user is not found:
{ "type": "ip_response", "target": "nonexistent_user", "error": "User offline" }
main.py- Main server implementationpyproject.toml- Project configuration and dependenciespoetry.lock- Lock file for reproducible builds
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.