xray

package
v1.260711.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyRunning = errors.New("xray is already running")

Functions

func GetXrayState

func GetXrayState() bool

Get Xray State

func Ping

func Ping(configPath string, timeout int, url string, proxy string) (int64, error)

Ping Xray config and find the delay and country code of its outbound. configPath means the config.json file path. timeout means how long the http request will be cancelled if no response, in units of seconds. url means the website we use to test speed. "https://www.google.com" is a good choice for most cases. proxy means the local http/socks5 proxy, like "socks5://[::1]:1080".

func RunXray

func RunXray(configPath string) (err error)

Run Xray instance. configPath means the config.json file path.

func RunXrayFromJSON

func RunXrayFromJSON(configJSON string) (err error)

Run Xray instance with JSON configuration string. configJSON means the JSON configuration string.

func StartXray

func StartXray(configPath string) (*core.Instance, error)

func StartXrayFromJSON

func StartXrayFromJSON(configJSON string) (*core.Instance, error)

func StopXray

func StopXray() error

Stop Xray instance.

func TestXray

func TestXray(configPath string) error

Test Xray Config. configPath means the config.json file path.

func XrayVersion

func XrayVersion() string

Xray's version

Types

This section is empty.

Jump to

Keyboard shortcuts

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