Sign inSign up

alh477/gsn-meter

By alh477

Updated 9 months ago

GSN Traffic Meter is a high-performance UDP and TCP proxy designed for the DeMoD Cloud Fabric (DCF)

Image
Networking
API management
Monitoring & observability
0

687

alh477/gsn-meter repository overview

GSN Traffic Meter

GSN Traffic Meter is a high-performance UDP and TCP proxy designed for the DeMoD Cloud Fabric (DCF) ecosystem. It provides real-time traffic metering and session-based billing for game server environments.

Overview

The service acts as a lightweight data plane that:

  • Routes game traffic through DCF infrastructure.

  • Meters bytes in and out per user session using atomic counters.

  • Reports usage to the DCF-ID accounting system for credit deduction.

  • Automatically cleans up idle sessions after a configurable timeout.

Key Features

Static Binary Architecture: Compiled against musl-libc to run in a scratch container for minimal security surface area.

High-Throughput Forwarding: Efficiently handles UDP packet forwarding between clients and backend game containers.

Usage Reporting: Configurable intervals for flushing usage data to ensure accurate billing.

Rustls Integration: Uses a pure Rust TLS implementation to eliminate external C-library dependencies like OpenSSL.

Deployment

Running the Container

The traffic meter is optimized to run as a standalone container. It requires the DCF_ID_URL and a secret internal key to authenticate usage reports.

docker run -d \
  --name gsn-meter \
  -p 9000:9000/udp \
  -p 9001:9001/tcp \
  -e DCF_ID_URL=http://dcf-id-api:4000 \
  -e DCF_ID_INTERNAL_KEY=your_secret_key \
  -e REPORT_INTERVAL_SECS=60 \
  alh477/gsn-meter:latest

Environment Variables
VariableDescriptionDefault
UDP_PORTPort used for game traffic forwarding.

| 9000 | | HTTP_PORT | Port for the management and metrics API.

| 9001 | | REPORT_INTERVAL_SECS | Frequency of usage reports sent to DCF-ID.

| 60 | | DCF_ID_URL | The endpoint for the DCF-ID authentication service.

| http://dcf-id:4000 |

API Endpoints

GET /health: Returns the current service status and global metrics.

POST /sessions/register: Used by the selector to authorize a new user session.

POST /servers/register: Maps a server ID to a specific backend container address.

GET /metrics: Provides detailed byte counts and packet forwarding statistics.


License

Copyright (c) 2025-2026, DeMoD LLC. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of DeMoD LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Tag summary

Content type

Image

Digest

sha256:c7dd043d6

Size

2.9 MB

Last updated

9 months ago

docker pull alh477/gsn-meter