Documentation
¶
Overview ¶
Package xray runs xray-core (github.com/xtls/xray-core) as an in-process Go library: it builds a config from a server profile and starts/stops an xray-core instance, in proxy mode (local HTTP/SOCKS) or TUN mode.
Index ¶
Constants ¶
const ( HTTPInboundPort = 2080 SOCKSInboundPort = 2081 // TUN adapter settings. Each connection gets its own 172.19.N.1/30 // (see manager.go); the kill switch allows all of 172.19.0.0/16. TUNMask = "255.255.255.252" TUNDNS = "1.1.1.1" )
Variables ¶
This section is empty.
Functions ¶
func CoreVersion ¶ added in v0.7.0
func CoreVersion() string
CoreVersion returns the embedded xray-core version, for the About panel. xray-core doesn't expose a runtime version constant, so this reads the resolved module version straight from the Go module graph instead.
func LogFilePath ¶
func LogFilePath() string
LogFilePath returns where xray-core's own error log is written.
func TUNAddress ¶ added in v0.11.0
TUNAddress is the address of TUN adapter slot n (1 or 2); each slot has its own, since a lingering adapter from the previous connection may still hold the other one.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the lifecycle of a single running xray-core instance.
func NewManager ¶
func NewManager() *Manager
type Mode ¶
type Mode = string
Mode selects what xray-core listens on: a local HTTP/SOCKS proxy ("proxy") or a TUN adapter capturing all system traffic ("tun").