### Realm URI Example Source: https://hysteria.network/docs/advanced/Realms An example of a realm URI, demonstrating the token, host, and realm name. ```plaintext realm://mytoken@rendezvous.example.com/my-server ``` -------------------------------- ### Install Hysteria from Local File Source: https://hysteria.network/docs/getting-started/Server-Installation-Script Installs Hysteria using a locally transferred executable file. Use this if your VPS cannot connect to GitHub Releases. ```bash bash <(curl -fsSL https://get.hy2.sh/) --local /path/to/hysteria-linux-amd64 ``` -------------------------------- ### Run Hysteria Client (Custom Config) Source: https://hysteria.network/docs/getting-started/Client Starts the Hysteria client using a specified configuration file. ```bash ./hysteria-linux-amd64-avx -c whatever.yaml ``` -------------------------------- ### Run Hysteria Client (Default Config) Source: https://hysteria.network/docs/getting-started/Client Starts the Hysteria client using the default configuration file name (`config.yaml`). ```bash ./hysteria-linux-amd64-avx ``` -------------------------------- ### Public Rendezvous Server Example Source: https://hysteria.network/docs/advanced/Realms Example URI for connecting to the public Hysteria rendezvous server. Use with caution as it's a best-effort service. ```plaintext realm://public@realm.hy2.io/ ``` -------------------------------- ### Example Type Selector Configuration Source: https://hysteria.network/docs/advanced/Full-Server-Config Demonstrates the 'type' selector pattern where a field can have multiple sub-configurations, and only the one matching the 'type' is parsed. ```yaml example: type: a a: something: something b: something: something c: something: something ``` -------------------------------- ### Realm URI with STUN Override Source: https://hysteria.network/docs/advanced/Realms Example of a realm URI including optional query parameters for overriding STUN servers. ```plaintext realm://mytoken@rendezvous.example.com/my-server?stun=stun1.example.com:3478&stun=stun2.example.com:3478 ``` -------------------------------- ### Run Hysteria Server with Default Configuration Source: https://hysteria.network/docs/getting-started/Server Start the Hysteria server using the default configuration file named 'config.yaml' in the current directory. ```bash ./hysteria-linux-amd64-avx server ``` -------------------------------- ### Hysteria Docker Compose Example Source: https://hysteria.network/docs/getting-started/Installation A Docker Compose configuration for deploying Hysteria as a server. This example sets up a container with persistent storage for ACME certificates and a custom configuration file. ```yaml version: "3.9" services: hysteria: image: tobyxdd/hysteria container_name: hysteria restart: always network_mode: "host" cap_add: - NET_ADMIN volumes: - acme:/acme - ./hysteria.yaml:/etc/hysteria.yaml command: ["server", "-c", "/etc/hysteria.yaml"] vols: acme: ``` -------------------------------- ### Run Hysteria Server with Custom Configuration File Source: https://hysteria.network/docs/getting-started/Server Start the Hysteria server using a custom configuration file specified with the '-c' flag. Replace 'whatever.yaml' with your actual configuration file name. ```bash ./hysteria-linux-amd64-avx server -c whatever.yaml ``` -------------------------------- ### Hysteria TOML Configuration Example Source: https://hysteria.network/docs/misc/Hate-YAML This TOML format can be used for Hysteria client configuration. Save the file with a `.toml` extension. ```toml server = "your.server.net" auth = "i_still_love_tom" fastOpen = true lazy = true [bandwidth] up = "30 mbps" down = "100 mbps" [socks5] listen = "127.0.0.1:1080" [http] listen = "127.0.0.1:8080" ``` -------------------------------- ### Example Type Selector Configuration Source: https://hysteria.network/docs/advanced/Full-Client-Config Demonstrates the 'type' selector pattern where one subfield is parsed based on the 'type' value, and others are ignored. ```yaml example: type: a a: something: something b: something: something c: something: something ``` -------------------------------- ### Hysteria 2 URI Example Source: https://hysteria.network/docs/developers/URI-Scheme An example of a complete Hysteria 2 URI demonstrating various parameters like authentication, port hopping, obfuscation, TLS settings, and certificate pinning. ```plaintext hysteria2://letmein@example.com:123,5000-6000/?insecure=1&obfs=salamander&obfs-password=gawrgura&pinSHA256=deadbeef&sni=real.example.com ``` -------------------------------- ### Hysteria JSON Configuration Example Source: https://hysteria.network/docs/misc/Hate-YAML Use this JSON structure for Hysteria client configuration. Ensure the file is saved with a `.json` extension. ```json { "server": "your.server.net", "auth": "i_still_love_jason", "bandwidth": { "up": "30 mbps", "down": "100 mbps" }, "fastOpen": true, "lazy": true, "socks5": { "listen": "127.0.0.1:1080" }, "http": { "listen": "127.0.0.1:8080" } } ``` -------------------------------- ### Hysteria 2 Realm Mode URI Example Source: https://hysteria.network/docs/developers/URI-Scheme An example of a Hysteria 2 URI in realm mode, showing the token, rendezvous host, realm name, and additional parameters like Hysteria authentication and TLS settings. ```plaintext hysteria2+realm://mytoken@rendezvous.example.com/my-cabin-1f3a8c2e9b?auth=your_password&insecure=1&pinSHA256=deadbeef ``` -------------------------------- ### Install or Upgrade Hysteria to a Specific Version Source: https://hysteria.network/docs/getting-started/Server-Installation-Script Installs or upgrades Hysteria to a specified version. Use this to pin to a particular release. ```bash bash <(curl -fsSL https://get.hy2.sh/) --version v2.9.2 ``` -------------------------------- ### Godaddy ACME DNS Configuration Source: https://hysteria.network/docs/advanced/ACME-DNS-Config Example configuration for using Godaddy as the DNS service provider with ACME DNS. ```yaml acme: domains: - "*.example.com" email: your@email.address type: dns dns: name: godaddy config: godaddy_api_token: Dxabckw9dB_jYBdi89kgyaS8wRjqqSsd679urScKOBP ``` -------------------------------- ### ACL Rule Examples Source: https://hysteria.network/docs/advanced/ACL Demonstrates various ACL rule configurations for routing traffic to specific outbounds, blocking protocols, and hijacking connections. These rules are applied in order, with the first match determining the action. ```yaml v6_only(suffix:google.com) ``` ```yaml v4_only(suffix:twitter.com) ``` ```yaml some_proxy(ipinfo.io) ``` ```yaml v6_only(战狼*.中国) ``` ```yaml reject(all, udp/443) ``` ```yaml reject(all, tcp/25) ``` ```yaml reject(geoip:cn) ``` ```yaml reject(geoip:kp) ``` ```yaml reject(geosite:facebook) ``` ```yaml reject(geosite:google@ads) ``` ```yaml reject(73.0.0.0/8) ``` ```yaml reject(2601::/20) ``` ```yaml default(8.8.8.8, *, 1.1.1.1) ``` ```yaml default(8.8.4.4, udp/53, 1.1.1.1) ``` ```yaml direct(all) ``` -------------------------------- ### Specify Architecture for Installation Source: https://hysteria.network/docs/getting-started/Server-Installation-Script Installs Hysteria for a specific architecture, such as the AVX version. Set the ARCHITECTURE environment variable before running the script. ```bash ARCHITECTURE=amd64-avx bash <(curl -fsSL https://get.hy2.sh/) ``` -------------------------------- ### Configure UDP TProxy (Linux) Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable transparent UDP proxying on Linux systems using TPROXY. Includes an optional timeout setting. Refer to TPROXY documentation for setup instructions. ```yaml udpTProxy: listen: :2500 timeout: 20s ``` -------------------------------- ### Realm URI with Local Port Binding Source: https://hysteria.network/docs/advanced/Realms Example of a realm URI including an optional query parameter to bind the local UDP socket to a specific source port. ```plaintext realm://mytoken@rendezvous.example.com/my-server?lport=12345 ``` -------------------------------- ### Configure TCP TProxy (Linux) Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable transparent TCP proxying on Linux systems using TPROXY. Requires specific setup as detailed in TPROXY documentation. ```yaml tcpTProxy: listen: :2500 ``` -------------------------------- ### Install Hysteria with Deployment Script (Linux) Source: https://hysteria.network/docs/getting-started/Installation Use this bash script to automatically download and configure the latest Hysteria version on Linux servers. It sets up a systemd service for common distributions. ```bash bash <(curl -fsSL https://get.hy2.sh/) ``` -------------------------------- ### Run Hysteria as Dedicated User Source: https://hysteria.network/docs/advanced/TPROXY Manually start the Hysteria client as the dedicated 'hysteria' user. For systemd services, configure the 'User=hysteria' directive. ```bash sudo -u hysteria /path/to/hysteria -c config.yaml ``` -------------------------------- ### GET /dump/streams Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Returns detailed information about each QUIC stream for Hysteria TCP proxy connections. Can return JSON or plain text. ```APIDOC ## GET /dump/streams ### Description This endpoint returns a JSON object containing information about each QUIC stream of a Hysteria TCP proxy connection. An `Accept: text/plain` header can be used for a human-readable output. ### Method GET ### Endpoint /dump/streams ### Headers - **Accept** (string) - Optional - `text/plain` for human-readable output, otherwise JSON is returned. ### Response #### Success Response (200) - JSON - **streams** (array) - An array of stream objects. - **state** (string) - The state of the stream (e.g., "estab"). - **auth** (string) - Authentication information. - **connection** (integer) - The connection ID. - **stream** (integer) - The stream ID. - **req_addr** (string) - The requested address. - **hooked_req_addr** (string) - The hooked requested address. - **tx** (integer) - Transmitted bytes. - **rx** (integer) - Received bytes. - **initial_at** (string) - Timestamp when the stream was initially established. - **last_active_at** (string) - Timestamp of the last activity on the stream. ### Response Example (JSON) ```json { "streams": [ { "state": "estab", "auth": "user", "connection": 3191736581, "stream": 4, "req_addr": "192.0.2.1:80", "hooked_req_addr": "example.com:80", "tx": 3937, "rx": 4441, "initial_at": "2024-11-08T16:07:45.956956773+09:00", "last_active_at": "2024-11-08T16:07:47.121503203+09:00" } ] } ``` ### Response Example (Text) ``` State Auth Connection Stream TX-Bytes RX-Bytes Lifetime Last-Active Req-Addr Hooked-Req-Addr ESTAB user BE3E0905 4 3937 4441 3.005s 1.84s 192.0.2.1:80 example.com:80 ``` ``` -------------------------------- ### Dump QUIC Stream Information (JSON) Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Get detailed information about each QUIC stream in a Hysteria TCP proxy connection, returned as a JSON object. ```json { "streams": [ { "state": "estab", "auth": "user", "connection": 3191736581, "stream": 4, "req_addr": "192.0.2.1:80", "hooked_req_addr": "example.com:80", "tx": 3937, "rx": 4441, "initial_at": "2024-11-08T16:07:45.956956773+09:00", "last_active_at": "2024-11-08T16:07:47.121503203+09:00" } ] } ``` -------------------------------- ### Running Hysteria Client with Configuration Source: https://hysteria.network/docs/misc/Hate-YAML Execute the Hysteria client using either a JSON or TOML configuration file. Ensure the path to the client binary is correct. ```bash ./hysteria-linux-amd64-avx -c config.json ``` ```bash ./hysteria-linux-amd64-avx -c config.toml ``` -------------------------------- ### Configure Basic Authentication Source: https://hysteria.network/docs/advanced/Full-Client-Config Set a simple password for server authentication. For 'userpass' authentication, use 'username:password' format. ```yaml auth: some_password ``` -------------------------------- ### Configure Routing Rules for TProxy (IPv4/IPv6) Source: https://hysteria.network/docs/advanced/TPROXY Set up IP routing rules for TProxy policy routing. These commands define the fwmark and table ID for TProxy and must be run on system boot unless made persistent. ```bash # IPv4 ip rule add fwmark 0x1 lookup 100 ip route add local default dev lo table 100 # IPv6 ip -6 rule add fwmark 0x1 lookup 100 ip -6 route add local default dev lo table 100 ``` -------------------------------- ### Build Hysteria Source: https://hysteria.network/docs/developers/Build Run these commands in the Hysteria repository root to build the application. Use `-r` for release builds or `-p` for production builds. ```bash python hyperbole.py build ``` ```bash python hyperbole.py build -r ``` ```bash python hyperbole.py build -p ``` -------------------------------- ### GET /online Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Returns a JSON map of online clients to their connection counts (number of Hysteria client instances). ```APIDOC ## GET /online ### Description This endpoint returns a JSON map of online clients to the number of connections they have. The connection count here refers to the number of Hysteria client instances ("devices"), NOT the number of active proxy connections. ### Method GET ### Endpoint /online ### Response #### Success Response (200) - **client_id** (string) - The ID of the online client. - **connection_count** (integer) - The number of Hysteria client instances for that client. ### Response Example ```json { "wang": 2, "joe": 1 } ``` ``` -------------------------------- ### Format and Tidy Code Source: https://hysteria.network/docs/developers/Build Run these commands before committing to ensure code is formatted correctly and dependencies are tidied. Requires `gofumpt`. ```bash python hyperbole.py format ``` ```bash python hyperbole.py tidy ``` -------------------------------- ### Configure Authentication Methods Source: https://hysteria.network/docs/advanced/Full-Server-Config Configure authentication using `password`, `userpass`, `http`, or `command`. Each type requires specific parameters. ```yaml auth: type: password | userpass | http | command password: your_password userpass: user1: pass1 user2: pass2 user3: pass3 http: url: http://your.backend.com/auth insecure: false command: /etc/some_command ``` -------------------------------- ### Configure QUIC Parameters Source: https://hysteria.network/docs/advanced/Full-Server-Config Adjust QUIC's initial and maximum stream/connection receive windows, idle timeout, and maximum incoming streams. These settings impact network throughput and stability. Changing window sizes is not recommended without a thorough understanding. ```yaml quic: initStreamReceiveWindow: 8388608 maxStreamReceiveWindow: 8388608 initConnReceiveWindow: 20971520 maxConnReceiveWindow: 20971520 maxIdleTimeout: 30s maxIncomingStreams: 1024 disablePathMTUDiscovery: false ``` -------------------------------- ### Get Traffic Statistics Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Retrieve a JSON map of client IDs to their traffic statistics (transmitted 'tx' and received 'rx' bytes). ```json { "wang": { "tx": 514, "rx": 4017 }, "joe": { "tx": 7790, "rx": 446623 } } ``` -------------------------------- ### Run Default Speed Test Source: https://hysteria.network/docs/advanced/Speed-Test Executes the speed test with default settings, which includes a 10-second test for both download and upload directions. ```bash ./hysteria-linux-amd64-avx speedtest ``` -------------------------------- ### GET /traffic Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Retrieves a JSON map of client IDs to their traffic statistics (transmitted and received bytes). Optionally clears statistics after retrieval. ```APIDOC ## GET /traffic ### Description This endpoint returns a JSON map of client IDs to their traffic statistics. ### Method GET ### Endpoint /traffic ### Query Parameters - **clear** (integer) - Optional - If set to 1, statistics are zeroed out after retrieval. ### Response #### Success Response (200) - **tx** (integer) - Transmitted bytes. - **rx** (integer) - Received bytes. ### Response Example ```json { "wang": { "tx": 514, "rx": 4017 }, "joe": { "tx": 7790, "rx": 446623 } } ``` ``` -------------------------------- ### Set Build Platforms Source: https://hysteria.network/docs/developers/Build Use the `HY_APP_PLATFORMS` environment variable to specify target platforms for the build. Separate multiple platforms with commas. ```bash export HY_APP_PLATFORMS="linux/amd64,windows/amd64,darwin/amd64" ``` -------------------------------- ### Manage Hysteria Service Source: https://hysteria.network/docs/getting-started/Server-Installation-Script Commands to manage the Hysteria systemd service, including enabling it at startup, starting it immediately, restarting it after configuration changes, and checking its status. ```bash systemctl enable --now hysteria-server.service ``` ```bash systemctl restart hysteria-server.service ``` ```bash systemctl status hysteria-server.service ``` -------------------------------- ### Get Online Clients Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Retrieve a JSON map of online client IDs to their connection counts. This count represents Hysteria client instances, not proxy connections. ```json { "wang": 2, "joe": 1 } ``` -------------------------------- ### Enable Fast Open Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable Fast Open to reduce connection latency by shaving off one roundtrip time. Note that this may affect the correct semantics of SOCKS5/HTTP proxy protocols. ```yaml fastOpen: true ``` -------------------------------- ### Configure Client for TProxy Source: https://hysteria.network/docs/advanced/TPROXY Add these lines to your client configuration to enable TProxy for TCP and UDP traffic. Ensure the listening port is correctly specified. ```yaml tcpTProxy: listen: :2500 udpTProxy: listen: :2500 ``` ```yaml tcpTProxy: listen: :2500 ``` -------------------------------- ### Run Speed Test with Custom Config Source: https://hysteria.network/docs/advanced/Speed-Test Performs a speed test using a specified configuration file. The speed test respects the bandwidth settings defined in this configuration. ```bash ./hysteria-linux-amd64-avx speedtest -c whatever.yaml ``` -------------------------------- ### Test Masquerade Configuration with Chrome Source: https://hysteria.network/docs/advanced/Full-Server-Config Launch Chrome with a specific flag to test the masquerade configuration by forcing QUIC connections to your site. ```bash chrome --origin-to-force-quic-on=your.site.com:443 ``` -------------------------------- ### Grant Network Bind Capability to Hysteria Executable Source: https://hysteria.network/docs/advanced/Troubleshooting Use this command to grant the Hysteria executable the necessary capability to bind to privileged ports (e.g., 443) without running the server as root. This is a common solution for 'permission denied' errors when starting the server. ```bash sudo setcap cap_net_bind_service=+ep ./hysteria-linux-amd64-avx ``` -------------------------------- ### Configure Server Address (Hysteria2 URI) Source: https://hysteria.network/docs/advanced/Full-Client-Config Uses a Hysteria 2 URI to connect to the server. Password and other settings are included in the URI. ```yaml server: "hysteria2://user:pass@example.com/" ``` -------------------------------- ### Server Listen Address Configuration Source: https://hysteria.network/docs/advanced/Full-Server-Config Sets the server's listen address. Defaults to :443 if omitted. ```yaml listen: :443 ``` -------------------------------- ### Configure Hysteria QUIC Flow Control Windows Source: https://hysteria.network/docs/advanced/Performance Sets the initial and maximum stream and connection receive window sizes for Hysteria's QUIC protocol. Adjust these to balance memory usage and throughput, maintaining a stream-to-connection ratio near 2/5. ```yaml quic: initStreamReceiveWindow: 26843545 maxStreamReceiveWindow: 26843545 initConnReceiveWindow: 67108864 maxConnReceiveWindow: 67108864 ``` -------------------------------- ### Configure ip6tables for TProxy (IPv6) Source: https://hysteria.network/docs/advanced/TPROXY Set up ip6tables rules for IPv6 traffic redirection and marking. This includes creating a mangle table, defining rules to skip specific traffic, and redirecting TCP/UDP to the TProxy port. It also includes rules for proxying local traffic, ensuring only public IPv6 addresses are proxied. ```bash ip6tables -t mangle -N HYSTERIA # Skip traffic already handled by TProxy ip6tables -t mangle -A HYSTERIA -p tcp -m socket --transparent -j MARK --set-mark 0x1 ip6tables -t mangle -A HYSTERIA -p udp -m socket --transparent -j MARK --set-mark 0x1 ip6tables -t mangle -A HYSTERIA -m socket -j RETURN # Only proxy public IPv6 addresses ip6tables -t mangle -A HYSTERIA ! -d 2000::/3 -j RETURN # Redirect traffic to the TProxy port ip6tables -t mangle -A HYSTERIA -p tcp -j TPROXY --on-port 2500 --on-ip ::1 --tproxy-mark 0x1 ip6tables -t mangle -A HYSTERIA -p udp -j TPROXY --on-port 2500 --on-ip ::1 --tproxy-mark 0x1 # Enable the above rules ip6tables -t mangle -A PREROUTING -j HYSTERIA # === Proxy Local Traffic - Start === ip6tables -t mangle -N HYSTERIA_MARK # Match user to prevent loops ip6tables -t mangle -A HYSTERIA_MARK -m owner --uid-owner hysteria -j RETURN # Only proxy public IPv6 addresses ip6tables -t mangle -A HYSTERIA_MARK ! -d 2000::/3 -j RETURN # Mark traffic to re-route it to PREROUTING ip6tables -t mangle -A HYSTERIA_MARK -p tcp -j MARK --set-mark 0x1 ip6tables -t mangle -A HYSTERIA_MARK -p udp -j MARK --set-mark 0x1 # Enable the above rules ip6tables -t mangle -A OUTPUT -j HYSTERIA_MARK # === Proxy Local Traffic - End === ``` -------------------------------- ### Command Authentication Arguments Source: https://hysteria.network/docs/advanced/Full-Server-Config When using command authentication, the server executes the specified command with these arguments to verify the client. ```bash /etc/some_command addr auth tx ``` -------------------------------- ### Configure Salamander Obfuscation Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable Salamander obfuscation to scramble QUIC packets. Ensure the password matches the server configuration. ```yaml obfs: type: salamander salamander: password: cry_me_a_r1ver ``` -------------------------------- ### Configure Server Address (Hysteria Realms URI) Source: https://hysteria.network/docs/advanced/Full-Client-Config Connects to a server in P2P mode using a Hysteria Realms URI, which includes a token and realm name. ```yaml server: realm://YOUR-TOKEN@rendezvous.example.com/your-realm-name ``` -------------------------------- ### Configure HTTP Proxy Mode Source: https://hysteria.network/docs/advanced/Full-Client-Config Set up an HTTP proxy server for HTTP proxy-compatible applications. Supports both plaintext HTTP and HTTPS (CONNECT). Authentication can be configured with username, password, and realm. ```yaml http: listen: 127.0.0.1:8080 username: king password: kong realm: martian ``` -------------------------------- ### Run Hysteria Client with Debug Logging Source: https://hysteria.network/docs/advanced/Realms Execute the Hysteria client with debug logging enabled to capture detailed output for troubleshooting connectivity issues. This is essential when reporting problems. ```bash HYSTERIA_LOG_LEVEL=debug ./hysteria client -c client.yaml ``` -------------------------------- ### Configure QUIC Parameters Source: https://hysteria.network/docs/advanced/Full-Client-Config Set QUIC transport parameters including receive window sizes, idle timeouts, and keep-alive periods. Socket options for binding interface and firewall marks are also configurable. ```yaml quic: initStreamReceiveWindow: 8388608 maxStreamReceiveWindow: 8388608 initConnReceiveWindow: 20971520 maxConnReceiveWindow: 20971520 maxIdleTimeout: 30s keepAlivePeriod: 10s disablePathMTUDiscovery: false sockopts: bindInterface: eth0 fwmark: 1234 fdControlUnixSocket: ./test.sock ``` -------------------------------- ### Enable HTTP/HTTPS Masquerading Source: https://hysteria.network/docs/advanced/Full-Server-Config Configure Hysteria to listen on standard HTTP/HTTPS ports to mimic websites offering HTTP/3 alongside traditional HTTP/HTTPS. ```yaml masquerade: # ... (your other options from above) listenHTTP: :80 listenHTTPS: :443 forceHTTPS: true ``` -------------------------------- ### Hysteria Server Configuration with Custom Certificate Source: https://hysteria.network/docs/getting-started/Server Use this configuration template if you have your own TLS certificate and key. Replace placeholders with your actual certificate, key, and desired password. ```yaml # listen: :443 tls: cert: your_cert.crt key: your_key.key auth: type: password password: Se7RAuFZ8Lzg masquerade: type: proxy proxy: url: https://news.ycombinator.com/ rewriteHost: true ``` -------------------------------- ### Configure TLS Certificate Source: https://hysteria.network/docs/advanced/Full-Server-Config Use this to specify a custom TLS certificate and key. Ensure `sniGuard` is set appropriately for your needs. ```yaml tls: cert: some.crt key: some.key sniGuard: strict | disable | dns-san clientCA: client.crt ``` -------------------------------- ### Enable Speed Test Server Source: https://hysteria.network/docs/advanced/Full-Server-Config Set `speedTest` to `true` to enable the built-in speed test server. This allows clients to measure their download and upload speeds against the server. ```yaml speedTest: false ``` -------------------------------- ### Configure TLS Settings Source: https://hysteria.network/docs/advanced/Full-Client-Config Customize TLS settings including SNI, security, certificate pinning, and custom CA or client certificates. ```yaml tls: sni: another.example.com insecure: false pinSHA256: BA:88:45:17:A1... ca: custom_ca.crt clientCertificate: client.crt clientKey: client.key ``` -------------------------------- ### Configure SOCKS5 Proxy Mode Source: https://hysteria.network/docs/advanced/Full-Client-Config Set up a SOCKS5 proxy server for SOCKS5-compatible applications. Supports both TCP and UDP. Ensure username and password are provided for authentication. ```yaml socks5: listen: 127.0.0.1:1080 username: user password: pass disableUDP: false ``` -------------------------------- ### Enable Lazy Connection Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable lazy connection mode to only attempt server connection when there's an incoming connection from a client mode. This avoids idle connections and is useful if the network might not be ready at startup. ```yaml lazy: true ``` -------------------------------- ### Convert YAML to JSON using yq Source: https://hysteria.network/docs/misc/Hate-YAML Use the `yq` command-line tool to convert a YAML configuration file to JSON format. This is useful for migrating existing configurations. ```bash yq config.yaml -o json > config.json ``` -------------------------------- ### Configure Traffic Stats API Source: https://hysteria.network/docs/advanced/Full-Server-Config Set up the Traffic Stats API to monitor server statistics and manage clients. A secret is recommended for security. ```yaml trafficStats: listen: :9999 secret: some_secret ``` -------------------------------- ### Create Dedicated User for Hysteria Source: https://hysteria.network/docs/advanced/TPROXY Create a system user specifically for running the Hysteria client to isolate its traffic. ```bash useradd --system hysteria ``` -------------------------------- ### Run Hysteria Server with Debug Logging Source: https://hysteria.network/docs/advanced/Realms Execute the Hysteria server with debug logging enabled to capture detailed output for troubleshooting connectivity issues. This is essential when reporting problems. ```bash HYSTERIA_LOG_LEVEL=debug ./hysteria server -c server.yaml ``` -------------------------------- ### Dump QUIC Stream Information (Plain Text) Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Obtain a human-readable, plain text output of QUIC stream information, similar to 'ss -atn'. Add 'Accept: text/plain' to the request header. ```text State Auth Connection Stream TX-Bytes RX-Bytes Lifetime Last-Active Req-Addr Hooked-Req-Addr ESTAB user BE3E0905 4 3937 4441 3.005s 1.84s 192.0.2.1:80 example.com:80 ``` -------------------------------- ### TCP Request Message Format Source: https://hysteria.network/docs/developers/Protocol Client sends this message to initiate a TCP connection request. It includes the target address and padding. ```protobuf [varint] 0x401 (TCPRequest ID) [varint] Address length [bytes] Address string (host:port) [varint] Padding length [bytes] Random padding ``` -------------------------------- ### Run Tests Source: https://hysteria.network/docs/developers/Build Execute tests to ensure code integrity. You can run all tests or specify a module like 'core'. Some tests may require additional Python packages. ```bash python hyperbole.py test ``` ```bash python hyperbole.py test core ``` -------------------------------- ### Configure Client Bandwidth Source: https://hysteria.network/docs/advanced/Full-Client-Config Set the maximum upload and download bandwidth for the client. This configuration enables the Brutal congestion control for the specified directions. Remove or comment out values to use non-Brutal controllers. ```yaml bandwidth: up: 100 mbps down: 200 mbps ``` -------------------------------- ### Name.com ACME DNS Configuration Source: https://hysteria.network/docs/advanced/ACME-DNS-Config Configuration for Name.com DNS provider. Requires a token, username, and server address. ```yaml acme: domains: - "*.example.com" email: your@email.address type: dns dns: name: namedotcom config: namedotcom_token: Dxabckw9dB_jYBdi89kgyaS8wRjqqSsd679urScKOBP namedotcom_user: user namedotcom_server: api.name.com ``` -------------------------------- ### Configure Multiple Outbounds (Direct, SOCKS5, HTTP) Source: https://hysteria.network/docs/advanced/Full-Server-Config Define multiple outbounds to route traffic through different methods. If ACL is not used, only the first outbound in the list will be active. ```yaml outbounds: - name: my_outbound_1 type: direct - name: my_outbound_2 type: socks5 socks5: addr: shady.proxy.ru:1080 username: hackerman password: Elliot Alderson - name: my_outbound_3 type: http http: url: http://username:password@sketchy-proxy.cc:8081 insecure: false ``` -------------------------------- ### Configure Salamander Obfuscation Source: https://hysteria.network/docs/advanced/Full-Server-Config Enable Salamander obfuscation to scramble network traffic. A strong password must be used and must match on both client and server. ```yaml obfs: type: salamander salamander: password: cry_me_a_r1ver ``` -------------------------------- ### Client Multi-Port Address Formats Source: https://hysteria.network/docs/advanced/Port-Hopping Specify multiple ports or port ranges for the client to use. The client will randomly select an initial port and periodically switch to another. ```text example.com:1234,5678,9012 example.com:20000-50000 example.com:1234,5000-6000,7044,8000-9000 ``` -------------------------------- ### Manual Port Forwarding with nftables Source: https://hysteria.network/docs/advanced/Port-Hopping Manually configure port forwarding using nftables to redirect traffic from a port range to the Hysteria server's listening port. ```nftables define INGRESS_INTERFACE="eth0" define PORT_RANGE=20000-50000 define HYSTERIA_SERVER_PORT=443 table inet hysteria_porthopping { chain prerouting { type nat hook prerouting priority dstnat; policy accept; iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter redirect to :$HYSTERIA_SERVER_PORT } } ``` -------------------------------- ### POST /kick Source: https://hysteria.network/docs/advanced/Traffic-Stats-API Kicks a list of clients by their IDs. Note that clients may attempt to reconnect. ```APIDOC ## POST /kick ### Description This endpoint allows you to kick a list of clients by their IDs. ### Method POST ### Endpoint /kick ### Request Body - **clients** (array of strings) - Required - A list of client IDs to kick. ### Request Example ```json ["wang", "joe"] ``` ### Note Due to the reconnect logic built into the client, it will attempt to reconnect after being kicked. To avoid having to repeatedly kick the same client, you should also block the user in your authentication backend. ``` -------------------------------- ### Set Server Bandwidth Limits Source: https://hysteria.network/docs/advanced/Full-Server-Config Define the maximum upload and download bandwidth per client on the server. These act as speed limits. Units like bps, kbps, mbps, gbps, tbps are supported. Setting to zero or omitting means no limit. ```yaml bandwidth: up: 1 gbps down: 1 gbps ``` -------------------------------- ### Configure UDP Transport Source: https://hysteria.network/docs/advanced/Full-Client-Config Customize the underlying UDP transport protocol for the QUIC connection. Use 'hopInterval' for fixed intervals or 'minHopInterval'/'maxHopInterval' for random intervals. ```yaml transport: type: udp udp: hopInterval: 30s # Or use random interval: # minHopInterval: 15s # maxHopInterval: 45s ``` -------------------------------- ### Configure Gecko Obfuscation Source: https://hysteria.network/docs/advanced/Full-Client-Config Enable Gecko obfuscation for advanced packet fragmentation and scrambling. Configure password and packet size limits. ```yaml obfs: type: gecko gecko: password: cry_me_a_r1ver minPacketSize: 512 maxPacketSize: 1200 ``` -------------------------------- ### Hysteria Client Configuration Source: https://hysteria.network/docs/getting-started/Client Defines server address, authentication, bandwidth limits, and proxy listen addresses for the Hysteria client. Ensure values match your server settings. ```yaml server: your.domain.net:443 auth: Se7RAuFZ8Lzg bandwidth: up: 20 mbps down: 100 mbps socks5: listen: 127.0.0.1:1080 http: listen: 127.0.0.1:8080 ```