/pingodown

Introduces latency on a UDP port for gaming purposes

Primary LanguageGoMIT LicenseMIT

PingODown

Adds extra latency to all players on a UDP proxy

Build status Docker Pulls Docker Stars Image size Image version

Join Slack channel GitHub last commit GitHub commit activity GitHub issues

Purpose

I have a home server hosting a shooting game server but my friends are in America and Europe, and they all have different 'ping' to the server.

As a fellow gopher and having pity of the 150ms ping of my friend, I wrote this UDP proxy program which induces latency to all the players such that players physically near the server can have extra latency, to give equal chances to far away players.

Features

  • UDP Proxy server for clients of a game server with extra ping options
  • Forces the highest latency of the server clients to all the clients
  • Uses ICMP to find the round trip from the server to each of the connected clients
  • Tiny 7.3MB Docker image (uncompressed)
  • Compatible with amd64, 386, arm64, arm32v7 and arm32v6 CPU architectures
  • Docker image tags and sizes
  • Runs without root as user 1000

Setup

  1. Use the following command:

    docker run -d -p 8000:8000/udp -e SERVER_ADDRESS=yourhost:9009 qmcgaw/pingodown

    You can also use docker-compose.yml with:

    docker-compose up -d
  2. You can update the image with docker pull qmcgaw/pingodown

Environment variables

Environment variable Default Possible values Description
SERVER_ADDRESS hostname:port The server to proxy packets to, i.e. myiporhost:9009
LISTEN_ADDRESS :8000 Listening proxy address
PING 100ms Artificial ping added for each connection
TZ America/Montreal string Timezone, for your logs timestampts essentially

Development

Using VSCode and Docker

  1. Install Docker
    • On Windows, share a drive with Docker Desktop and have the project on that partition
    • On OSX, share your project directory with Docker Desktop
  2. With Visual Studio Code, install the remote containers extension
  3. In Visual Studio Code, press on F1 and select Remote-Containers: Open Folder in Container...
  4. Your dev environment is ready to go!... and it's running in a container 👍

See also contributing

TODOs

  • Web UI
    • Ping per player slider
    • Random ping variation, for extra fun
  • Unit testing
  • Integration testing with 2 udp clients and 1 udp server (a lot of work sadly)

License

This repository is under an MIT license unless otherwise indicated