Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/openlegends/server

OpenLegends Game Server
https://github.com/openlegends/server

api game openlegends server

Last synced: 23 days ago
JSON representation

OpenLegends Game Server

Awesome Lists containing this project

README

        

# OpenLegends Game Server

![Build](https://github.com/openlegends/server/actions/workflows/build.yml/badge.svg)
[![Dependencies](https://deps.rs/repo/github/openlegends/server/status.svg)](https://deps.rs/repo/github/openlegends/server)
[![crates.io](https://img.shields.io/crates/v/openlegends-server.svg)](https://crates.io/crates/openlegends-server)

OpenLegends socket server to play multiplayer game

> [!IMPORTANT]
> Project in development!
>

## Install

### Dependencies

Debian


sudo apt install curl openssl sqlite3

Fedora


sudo dnf install curl openssl sqlite

### Rust

Use [rustup](https://rustup.rs) installer to setup latest Rust environment:

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

### Server

``` bash
cargo install openlegends-server
```

## Setup

Setup Diesel ORM


cargo install diesel_cli --no-default-features --features sqlite
diesel migration run --database-url path/to/db.sqlite

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
* `--database`, `-d` required, filepath to SQLite database
* `--identity`, `-i` required, filepath to server identity in PKCS (PFX) format
* `--password`, `-p` optional, unlock encrypted `identity` by passphrase

### Start

``` bash
openlegends-server --address 127.0.0.1:4321 \
--database path/to/db.sqlite \
--identity path/to/server.pfx
```

Test connection


openssl s_client -connect 127.0.0.1:4321

## Commands

> [!NOTE]
> See also [official client](https://github.com/openlegends/client) and [shared API](https://github.com/openlegends/api) libraries
>

### Server

**Request**
```
server/about\r\n
```
**Response**
```json
{
"version": "string"
}
```

**Request**
```
server/status\r\n
```
**Response**
```json
{
"online": "bool"
}
```

### User

#### Login

**Request**
```
user/login\r\n
{
"username": "string",
"password": "string",
}
```
**Response**
```json
{
"success": "bool",
"message": "string",
"token": "string"
}
```

#### Register

**Request**
```
user/register\r\n
{
"username": "string"
}
```
**Response**
```json
{
"success": "bool",
"message": "string"
}
```