tuning

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package tuning applies host-level network optimizations recommended for an Xray server — currently enabling the TCP BBR congestion-control algorithm, which noticeably improves throughput on lossy/long-haul links.

See https://xtls.github.io/en/document/level-0/ch07-xray-server.html (7.7).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Active added in v0.13.0

func Active() bool

Active reports whether BBR is the congestion-control algorithm in force right now. It re-reads the kernel rather than trusting what EnsureBBR returned at boot, so the health report reflects reality even if something changed the sysctl since.

Types

type BBRState

type BBRState int

BBRState is the outcome of EnsureBBR, for logging.

const (
	BBRAlready   BBRState = iota // already active, nothing to do
	BBREnabled                   // we just switched it on
	BBRUnchanged                 // couldn't enable (kernel lacks BBR, not root, …)
)

func EnsureBBR

func EnsureBBR() (BBRState, error)

EnsureBBR enables BBR congestion control if it isn't already active. It persists the setting via a sysctl drop-in (so it survives reboots) AND applies it at runtime, so no reboot is needed. Best-effort and idempotent: it returns the resulting state plus any error for the caller to log, and never fails the boot. Requires root (the panel runs as root under systemd); on a non-Linux/non-root host the /proc and /etc writes simply fail and it reports BBRUnchanged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL