Documentation
¶
Index ¶
- func GetXrayState() bool
- func InitEnv(datDir string)
- func Ping(datDir string, configPath string, timeout int, url string, proxy string) (int64, error)
- func RunXray(datDir, configPath string) (err error)
- func RunXrayFromJSON(datDir, configJSON string) (err error)
- func SetTunFd(fd int32)
- func StartXray(configPath string) (*core.Instance, error)
- func StartXrayFromJSON(configJSON string) (*core.Instance, error)
- func StopXray() error
- func TestXray(datDir string, configPath string) error
- func XrayVersion() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ping ¶
Ping Xray config and find the delay and country code of its outbound. datDir means the dir which geosite.dat and geoip.dat are in. 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 ¶
Run Xray instance. datDir means the dir which geosite.dat and geoip.dat are in. configPath means the config.json file path.
func RunXrayFromJSON ¶
Run Xray instance with JSON configuration string. datDir means the dir which geosite.dat and geoip.dat are in. configJSON means the JSON configuration string.
func SetTunFd ¶
func SetTunFd(fd int32)
SetTunFd sets the TUN file descriptor. Call this BEFORE RunXray/RunXrayFromJSON.
Types ¶
This section is empty.