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 ( // 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 ¶
var ( HTTPInboundPort = 2080 SOCKSInboundPort = 2081 )
Local proxy ports (proxy mode). Defaults; the user can change them (SetPorts), and the choice is kept in ports.json in Kite's config folder.
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 SetPorts ¶ added in v0.24.0
SetPorts changes the local proxy ports for the next connection and saves them.
func TUNAddress ¶ added in v0.11.0
TUNAddress is the address of TUN adapter slot n; each slot has its own, since a lingering adapter from an earlier connection may still hold another 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").