probe

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package probe measures server latency three ways, shared by the desktop and Android apps:

  • TCP: time to open a TCP connection to the server. Fast, but only proves the port is reachable.
  • HTTP: time until the server answers a plain HTTP request on its port.
  • Real: start a temporary xray-core instance using the server and time a real request through it. Slowest, but the only mode that proves the server actually works (right keys, transport, encryption...).

Index

Constants

View Source
const (
	ModeTCP  = "tcp"
	ModeHTTP = "http"
	ModeReal = "real"

	// TestURL returns an empty 204 quickly from everywhere; it's what most
	// V2Ray clients use for "real delay".
	TestURL = "https://www.gstatic.com/generate_204"
)

Variables

This section is empty.

Functions

func Ping

func Ping(server profile.Server, mode string) (int, error)

Ping returns the delay to server in milliseconds using mode.

func TimeRequest added in v0.14.1

func TimeRequest(transport *http.Transport, target string) (int, error)

TimeRequest measures a request's round trip through transport the way most V2Ray clients report "real delay": a first request opens the tunnel (TCP + TLS/REALITY handshakes to the server, then to the test site), and the second one -- reusing that connection -- is what's timed. Timing the first request alone mostly measures one-off handshakes, not latency.

Types

This section is empty.

Jump to

Keyboard shortcuts

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