hysteria2

package
v0.1.81-dev.8 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hysteria2 is the node's Hysteria2 engine (engine.Engine) on top of the hysteria core library (github.com/apernet/hysteria/core/v2).

One Engine serves every hysteria2 inbound on the node; each inbound is one core server on its own UDP port.

  • Users: an immutable credential index (sha256(token) -> credential) behind an atomic pointer. A users-only Apply swaps it without touching the listener; a spec change restarts only that inbound.
  • Kick: the core can only close a connection from inside LogTraffic, so dropping a credential from the index (or an explicit Kick token, or an expired term) makes the next packet of that connection fail.
  • Traffic: per-credential atomic counters, reported from the user's side (core tx = up, core rx = down).
  • Masquerade: the decoy over HTTP/3 (core MasqHandler) and HTTPS on TCP (masq.go).
  • Egress: Env.Egress (internal/node/egress), with an IP-preserving sniffing RequestHook; explicit domain destinations are resolved by the node.

Index

Constants

View Source
const Protocol = "hysteria2"

Protocol is the plugin id this engine serves.

Variables

View Source
var BindIP net.IP

BindIP is the local address the inbounds listen on (the QUIC UDP port and the TCP decoy). nil is all interfaces, which is what a node must do and the only value production ever has. Tests that run a real engine set it to a loopback address in TestMain: a test binary listening on every interface makes Windows ask for a firewall rule on each run.

View Source
var Factory engine.Factory = New

Factory is the engine.Factory the agent registers for "hysteria2".

Functions

func New

func New(env engine.Env) (engine.Engine, error)

New builds the engine. Env.Certs is required; Env.Egress defaults to egress.New(Env.DNS) for "direct".

Types

This section is empty.

Jump to

Keyboard shortcuts

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