Skip to content

Add option to show traffic stats from server perspective #1472

@german2285

Description

@german2285

Is your feature request related to a problem? Please describe.

The Traffic Stats API shows traffic from the client's perspective (tx = client upload, rx = client download), but this creates problems when comparing with server monitoring tools and hosting provider reports.

Real example - after downloading a 100MB file:

  • Hysteria Traffic Stats: rx: 105MB, tx: 0.7MB = 105.7 MB total
  • vnstat (server): tx: 177MB, rx: 102MB = 279 MB total
  • My hosting provider billing: matches vnstat (279 MB), not Hysteria!

The critical problem:
If I rely only on Traffic Stats API to monitor my 15TB/month VPS limit, I would think I used only 105.7 MB, but actually consumed 279 MB (2.6x more!). This makes it impossible to predict when I'll hit my traffic limit and avoid overage fees.

Describe the solution you'd like

Add an option to show stats from server perspective:

trafficStats:
  perspective: server  # or "client" (default)

Or: GET /traffic?perspective=server

With perspective: server:

  • tx = bytes sent by server (matches what hosting provider counts)
  • rx = bytes received by server
  • Total would match vnstat and hosting billing

Describe alternatives you've considered

Using wrapper scripts to swap tx/rx, but this is error-prone and doesn't solve the traffic calculation mismatch (server sees 279 MB while API shows only 105.7 MB due to protocol overhead).

Additional context

Server administrators need stats that match OS-level tools (vnstat, iptables) and hosting provider billing to:

  • Accurately track bandwidth against VPS limits
  • Set correct usage alerts (e.g., 90% of 15TB)
  • Avoid surprise overage charges
  • Fairly distribute bandwidth among users

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions