ui

package
v0.0.0-...-876fa33 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const XrayFWMark int32 = 255

XrayFWMark is set on all outbound sockets so policy routing can exempt Xray's own traffic from the TUN interface when system proxy is active.

Variables

This section is empty.

Functions

func CleanupStaleProxy

func CleanupStaleProxy(_ int)

CleanupStaleProxy removes routing rules left over from a previous crash. The TUN interface itself vanishes automatically when the process that owned the fd dies, so only the ip rules need cleaning up.

func DisableStartup

func DisableStartup() error

func DisableSystemProxy

func DisableSystemProxy()

func EnableStartup

func EnableStartup() error

func EnableSystemProxy

func EnableSystemProxy(socksPort int) error

func NetAdminAvailable

func NetAdminAvailable() bool

func Start

func Start(d *Deps)

func StartupEnabled

func StartupEnabled() bool

func SystemProxyAvailable

func SystemProxyAvailable() bool

Types

type Deps

type Deps struct {
	ConfigFiles *cmdarg.Arg
	DefaultKey  string // baked-in default (from -X main.defaultConfigFiles=…)
	Port        *int

	// AutoEnable starts the proxy immediately on launch (set via -X main.defaultEnabled=true).
	AutoEnable bool
	// AutoSysProxy also enables system-wide proxy on launch; implies AutoEnable.
	AutoSysProxy bool
	// AutoStartup registers the binary as a login item on launch (macOS only).
	AutoStartup bool

	// StartXray creates and starts the proxy server; returns a handle to close it.
	StartXray    func() (io.Closer, error)
	ValidateKey  func(string) error
	ParseName    func(string) string
	PrintVersion func()
}

Deps carries everything the UI needs from the main package.

Jump to

Keyboard shortcuts

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