Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining branches #63

Merged
merged 66 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e818242
Await inline for user subscription altering to ensure they appear at …
jacobtread Sep 29, 2023
1201f8d
Seperated admin add from player connect, Defer game modifications int…
jacobtread Sep 29, 2023
cc61579
Bump version to beta
jacobtread Sep 29, 2023
2be2646
Bump cargo lock
jacobtread Sep 30, 2023
27f0cb2
Nginx client auth example
jacobtread Sep 30, 2023
0a6cccc
Added notes to user session ext data DMAP
jacobtread Sep 30, 2023
c415db7
Added host config variable to listen to specific host
jacobtread Oct 1, 2023
de28c6c
Merge pull request #57 from PocketRelay/56-feature-listen-only-on-spe…
jacobtread Oct 1, 2023
31261ef
Updated README
jacobtread Oct 1, 2023
890d85f
Increased max release attempts
jacobtread Oct 2, 2023
77401df
Handle packet processing tasks within same task
jacobtread Oct 8, 2023
9b1fa59
Working on session notification handles and queue locking
jacobtread Oct 8, 2023
b3d5caa
Renamed push_all to notify_all and use owned value instead of borrowed
jacobtread Oct 8, 2023
a3754aa
Updated qos preauth qos comments and reduce probe number to 1 for tes…
jacobtread Oct 9, 2023
27ca686
RPRT bits comment
jacobtread Oct 9, 2023
7edab52
Re-ordered game setup thanks to new locking system
jacobtread Oct 12, 2023
0b8173f
Removed async requirement for game player adding
jacobtread Oct 12, 2023
3d36aff
Hand wrote future for handling session IO, Removed player info from s…
jacobtread Oct 12, 2023
a6b1468
Spawn off session new start task
jacobtread Oct 12, 2023
adacbe9
Replaced player session references with weak references
jacobtread Oct 12, 2023
976745e
Made session game references weak
jacobtread Oct 12, 2023
d88be4a
Moved connected state to create game handler, Created locale constant…
jacobtread Oct 12, 2023
a7df81c
Early drop game player after removing when its not used
jacobtread Oct 12, 2023
7753200
Replaced mesh update match with !matches
jacobtread Oct 12, 2023
4fc5b78
Updated session service to have weak references and use a std mutex i…
jacobtread Oct 13, 2023
334a070
Handle session service lock poison with expect
jacobtread Oct 13, 2023
f94bb6d
Added parking_lot and replaced session service mutex with parking_lot…
jacobtread Oct 13, 2023
b2a61c8
Replaced session rwlocking with optimized parkinglot mutex as theres …
jacobtread Oct 13, 2023
7164810
Swapped matchmaking rwlock for mutex
jacobtread Oct 13, 2023
1c0cc1d
Added back auth info to debug messages now that locks don't require a…
jacobtread Oct 13, 2023
b0f1bac
Fixed debug auth logging referencing wrong fields
jacobtread Oct 13, 2023
27a5f8d
Updated stop docs
jacobtread Oct 13, 2023
43f48b9
Removed unused async from game_data
jacobtread Oct 13, 2023
777cb1a
Replaced leaderboard locks
jacobtread Oct 13, 2023
2a781e5
Bumped dependencies
jacobtread Oct 14, 2023
ed0e831
Disabled qos server config option
jacobtread Oct 18, 2023
fab5c16
Added handling for hamachi specific local addresses
jacobtread Oct 18, 2023
deb8864
Upnp set client metric handling
jacobtread Nov 12, 2023
18f9cca
Fixed QueueLock aquire deadlock
jacobtread Nov 13, 2023
21c28cb
Naming fixes, added docs for fields from source, added proper latency…
jacobtread Nov 13, 2023
7680f42
Fixed nlmp ordering
jacobtread Nov 13, 2023
e03e9de
Properly documented DMAP field
jacobtread Nov 15, 2023
60e3d8d
Only use set client metrix wan address if not double nat
jacobtread Nov 15, 2023
6be65ce
Documented more game fields and added more enums to handle typed values
jacobtread Nov 15, 2023
b616a71
Updated slot type and constant for team index
jacobtread Nov 15, 2023
398410d
Compute protocol version hash at runtime
jacobtread Nov 15, 2023
7b5d53b
Added constants for magic numbers within version hashing
jacobtread Nov 15, 2023
8f9f5b9
Explicit constant lifetimes lint for new rust version
jacobtread Nov 19, 2023
032439c
Removed unused extra task spawning for game related logic
jacobtread Nov 28, 2023
1a89e1d
Removed session ID type alias
jacobtread Nov 28, 2023
e0b3539
Persisting partial frames to prevent redecoding
jacobtread Nov 29, 2023
60eac91
Cleaned up public address parsing
jacobtread Nov 29, 2023
cfb824d
Dependencies todos for future hyper upgrade
jacobtread Dec 3, 2023
37422f0
Small README wording tweak
jacobtread Dec 4, 2023
b5e8db4
Updated README
jacobtread Dec 4, 2023
35164c1
Working basic db leaderboard implementation
jacobtread Dec 5, 2023
31eb869
Replaced leaderboard with new database bound leaderboard
jacobtread Dec 5, 2023
0ce16f6
Fixed leaderboard ranking ordering, added constants for duplicated va…
jacobtread Dec 5, 2023
dab0458
Cleaned up leaderboard centering and upsert conflict handling
jacobtread Dec 5, 2023
fd435e2
Bumped minor version for breaking change
jacobtread Dec 5, 2023
22a962a
Merge pull request #61 from PocketRelay/60-task-persistent-leaderboards
jacobtread Dec 5, 2023
778d5e7
Bumped ring dep and updated locked deps
jacobtread Dec 5, 2023
788e603
Added warn unused deps lint and removed unused futures dep
jacobtread Dec 5, 2023
accd412
Added seeder for seeding testing data
jacobtread Dec 5, 2023
2283b74
Cleaned up seeding code
jacobtread Dec 5, 2023
3269a18
Updated note about chosen branches
jacobtread Dec 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
782 changes: 440 additions & 342 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pocket-relay"
version = "0.5.10"
version = "0.6.0-beta"
description = "Pocket Relay Server"
readme = "README.md"
keywords = ["EA", "PocketRelay", "MassEffect"]
Expand Down Expand Up @@ -32,7 +32,7 @@ argon2 = { version = "0.5", features = ["std"] }

base64ct = { version = "1.5", features = ["alloc"] }
flate2 = { version = "1", features = ["zlib"], default-features = false }
ring = "0.16"
ring = "0.17"

# Library for obtaining the local IP address of the device
local-ip-address = "0.5"
Expand All @@ -46,16 +46,16 @@ email_address = "0.2.4"
# Codec utils for encoding and decoding packets
tokio-util = { version = "0.7", features = ["codec"] }

# Hyper for connection upgrades
# Hyper for connection upgrades (TODO: Update to 1.0 once reqwest supports it)
hyper = "0.14.25"
tower = "0.4"

bitflags = { version = "2.3.1", features = ["serde"] }
tdf = { version = "0.1" }
bytes = "1.4.0"
futures = "0.3"

indoc = "2"
parking_lot = "0.12.1"

# SeaORM
[dependencies.sea-orm]
Expand Down Expand Up @@ -87,7 +87,7 @@ features = [
"sync",
]

# Axum web framework
# Axum web framework (TODO: Update to 0.7 once once reqwest supports hyper 1.0)
[dependencies.axum]
version = "0.6.1"
default-features = false
Expand All @@ -111,6 +111,10 @@ version = "0.4"
default-features = false
features = ["std", "serde"]

[dev-dependencies]
# Random numbers for seeding
rand = "0.8"

[profile.release]
strip = true
lto = true
Expand Down
53 changes: 22 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Pocket Relay

<img src="https://raw.githubusercontent.com/PocketRelay/.github/main/assets/logo-new-text.svg" width="100%" height="120px">

# Pocket Relay

*Mass Effect 3 Server Emulator / Private Server*


![License](https://img.shields.io/github/license/PocketRelay/Server?style=for-the-badge)
![Build](https://img.shields.io/github/actions/workflow/status/PocketRelay/Server/rust.yml?style=for-the-badge)

[Discord Server (discord.gg/yvycWW8RgR)](https://discord.gg/yvycWW8RgR)
[Website (pocket-relay.pages.dev)](https://pocket-relay.pages.dev/)

Development is undergone on the [dev](https://github.com/PocketRelay/Server/tree/dev) branch so the master branch can be
considered semi stable with only non breaking changes being merged in-between releases
[Discord Server (discord.gg/yvycWW8RgR)](https://discord.gg/yvycWW8RgR) | [Website (pocket-relay.pages.dev)](https://pocket-relay.pages.dev/)


The master branch contains the latest changes and may not be stable for general use, if you would like to compile a stable version from source its recommened you use a specific tag rather than master

**Pocket Relay** Is a custom implementation of the Mass Effect 3 multiplayer servers all bundled into a easy to use server with a Dashboard for managing accounts and inventories.

With **Pocket Relay** you can play Mass Effect 3 multiplayer offline by yourself, over LAN, or even over WAN as a public server
With **Pocket Relay**, you can play Mass Effect 3 multiplayer offline, over LAN, or even over WAN as a public server.

View the website for information https://pocket-relay.pages.dev/
Visit the [website](https://pocket-relay.pages.dev/) for more information.


## 📌 EA / BioWare Notice
## 🌐 EA / BioWare Notice

The **Pocket Relay** software in all its forms are in no way or form supported, endorsed, or provided by BioWare or Electronic Arts. Mass Effect is a registered trademark of Bioware/EA International (Studio and Publishing), Ltd in the U.S. and/or other countries. All Mass Effect art, images, and lore are the sole property of Bioware/EA International (Studio and Publishing), Ltd and have been reproduced here in an effort to assist the Mass Effect player community. All other trademarks are the property of their respective owners.
The **Pocket Relay** software, in all its forms, is not supported, endorsed, or provided by BioWare or Electronic Arts. Mass Effect is a registered trademark of Bioware/EA International (Studio and Publishing), Ltd in the U.S. and/or other countries. All Mass Effect art, images, and lore are the sole property of Bioware/EA International (Studio and Publishing), Ltd and are reproduced here to assist the Mass Effect player community. All other trademarks are the property of their respective owners.


## 📖 Starting your own server
Expand All @@ -35,8 +35,8 @@ the [Server Setup Guide](https://pocket-relay.pages.dev/guide/server/)

Below is a table of the download links for the different platforms

| Platform | Download |
| -------- | ------------------------------------------------------------------------------------------------------- |
| Platform | Download |
| -------- | --------------------------------------------------------------------------------------------------- |
| Windows | [Download](https://github.com/PocketRelay/Server/releases/latest/download/pocket-relay-windows.exe) |
| Linux | [Download](https://github.com/PocketRelay/Server/releases/latest/download/pocket-relay-linux) |

Expand All @@ -45,33 +45,24 @@ You can find individual releases on the [Releases](https://github.com/PocketRela

## 🔧 Configuration

In order to configure the server such as changing the ports you can see the
configuration documentation [Here (docs/CONFIG.md)](https://pocket-relay.pages.dev/guide/config/)

To configure the server, such as changing ports, refer to the [Configuration Documentation](https://pocket-relay.pages.dev/guide/config/).

## ⚙️ Features

- **Origin Support** This server supports **Origin** / **EA Launcher** copies of the game through its fetching system. As long as the official servers are still available and you have internet access the server will connect to the official servers to authorize **Origin** accounts. *This behavior can be disabled using the `PR_ORIGIN_FETCH` environment variable*
- **Origin Fetching** Along with supporting **Origin** authentication your player data from the official servers can also be loaded for those logging into **Origin** accounts. *This behavior can be disabled using the `PR_ORIGIN_FETCH_DATA` environment variable*
- **Portable & Platform Independent** This server can be run on most hardware and software due to its low requirements and custom
implementations of lots of required portions allowing you to run it
on Windows, Linux, etc. *Note the server will store the player data and logging in a folder named `data` in the same folder as the exe*
- **Cracked Support** This server supports cracked Mass Effect 3 copies so you can play on the server using them.
- **Docker Support** This server includes a `Dockerfile` so that it can be run in a containerized environment. The server uses a small alpine linux container to run inside
- **Dashboard** The server includes a management dashboard
- This includes leaderboards displays
- Allowing players to edit their username, email, and password
- Deleting and managing accounts
- Viewing running games
- Inventory editing for admins (Weapons, Classes, Characters, etc)
- View server logs as super admin
- **Origin Support:** Connects to official servers to authorize **Origin**/**EA Launcher** accounts (configurable).
- **Origin Fetching:** Loads player data from official servers for **Origin** accounts (configurable).
- **Portable & Platform Independent:** Low hardware requirements, platform-independent (data stored in a 'data' folder).
- **Unofficial Support:** Allows playing with unofficially licensed Mass Effect 3 copies.
- **Docker Support:** Includes a `Dockerfile` for containerized deployment in a small Alpine Linux container.
- **Dashboard:** Management dashboard with leaderboards, account management, game monitoring, and more.


## 🚀 Manual Building

Instructions for building the server can be found at https://pocket-relay.pages.dev/docs/server/manual-building
Build instructions can be found [here](https://pocket-relay.pages.dev/docs/server/manual-building).

> **Note**
> Building the server can be quite a heavy load on your computer
> Building the server can be resource-intensive.


## 🧾 License
Expand Down
4 changes: 4 additions & 0 deletions examples/nginx-client-auth/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data
server.crt
server.key
client.crt
4 changes: 4 additions & 0 deletions examples/nginx-client-auth/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"port": 80,
"reverse_proxy": true
}
23 changes: 23 additions & 0 deletions examples/nginx-client-auth/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3"
services:
server:
restart: unless-stopped
container_name: pocket-relay
image: jacobtread/pocket-relay:latest
volumes:
# Bind the server config to a local config.json file
- ./config.json:/app/config.json
# Binding the server data to a local data folder
- ./data:/app/data
nginx:
restart: unless-stopped
image: nginx
ports:
- "443:443/tcp"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./client.crt:/etc/nginx/client.crt:ro
- ./server.crt:/etc/nginx/server.crt:ro
- ./server.key:/etc/nginx/server.key:ro
depends_on:
- server
28 changes: 28 additions & 0 deletions examples/nginx-client-auth/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
events {}

http {
server {
listen 443 ssl;

server_name localhost;

ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;

ssl_client_certificate /etc/nginx/client.crt;
ssl_verify_client on;


location / {
proxy_pass http://server:80;

# Provide server with real IP address of clients
proxy_set_header X-Real-IP $remote_addr;

# Upgrade websocket connections
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
}
}
}
16 changes: 15 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use log::LevelFilter;
use serde::Deserialize;
use std::{env, fs::read_to_string, path::Path};
use std::{
env,
fs::read_to_string,
net::{IpAddr, Ipv4Addr},
path::Path,
};

use crate::session::models::Port;

Expand Down Expand Up @@ -60,6 +65,7 @@ pub fn load_config() -> Option<Config> {
#[derive(Deserialize)]
#[serde(default)]
pub struct Config {
pub host: IpAddr,
pub port: Port,
pub qos: QosServerConfig,
pub reverse_proxy: bool,
Expand All @@ -73,6 +79,7 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Self {
host: IpAddr::V4(Ipv4Addr::UNSPECIFIED),
port: 80,
qos: QosServerConfig::default(),
reverse_proxy: false,
Expand All @@ -95,6 +102,13 @@ pub enum QosServerConfig {
Local,
/// Use a custom QoS server
Custom { host: String, port: u16 },
/// Disable the QoS server (Public IP *wont* be resolved)
Disabled,
/// Configuration to use when using hamachi
Hamachi {
/// The address of the host computer (Required for 127.0.0.1 resolution)
host: Ipv4Addr,
},
}

#[derive(Deserialize)]
Expand Down