1 unstable release

0.3.0 Dec 22, 2024
0.2.0 Dec 20, 2024
0.1.0 Dec 20, 2024

#485 in Game dev

Download history 118/week @ 2024-12-14 212/week @ 2024-12-21 4/week @ 2024-12-28 2/week @ 2025-01-04

336 downloads per month
Used in openlegends-client

MIT license

18KB
469 lines

OpenLegends Game Server

build crates.io

OpenLegends socket server to play multiplayer game

[!IMPORTANT] Project in development!

Install

Dependencies

Debian
sudo apt install curl openssl
Fedora
sudo dnf install curl openssl

Rust

Use rustup installer to setup latest Rust environment:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Server

cargo install openlegends-server

Setup

Generate PKCS (PFX)
openssl genpkey -algorithm RSA -out server.pem -pkeyopt rsa_keygen_bits:2048
openssl req -new -key server.pem -out request.csr
openssl x509 -req -in request.csr -signkey server.pem -out server.crt -days 365
openssl pkcs12 -export -out server.pfx -inkey server.pem -in server.crt

Launch

Arguments

  • --address, -a required, server host:port to listen incoming connections
  • --identity, -i required, filepath to server identity in PKCS (PFX) format
  • --password, -p optional, unlock encrypted identity by passphrase

Start

openlegends-server --address 127.0.0.1:4321 --identity path/to/server.pfx
Test connection
openssl s_client -connect 127.0.0.1:4321

Commands

[!NOTE]

  • Server requires from client TLS 1.2 certificate as the user identity
  • Request size limited to 1024 bytes
  • See also official client and shared server API libraries

Server

Request

server/about\r\n

Response

{
    "version": "string"
}

Request

server/status\r\n

Response

{
    "online": "bool"
}

User

Request

user/register\r\n
{
    "username": "string"
}

Response

{
    "success": "bool",
    "message": "string"
}

Dependencies

~5–16MB
~221K SLoC