How kykiles/xray-runner works
xray-runner is a Linux/Windows VPN client for importing provider links or subscriptions, choosing a profile/server, and running Xray-core through either the system proxy or a TUN interface. Its main workflow spans subscription retrieval and parsing, server selection, config construction, core execution and network setup, then status monitoring and cleanup. Separate branches cover privileged service operation, split routing, updates, and saved config display. README documents the product workflow; some internal calls are not visible in the excerpts, so uncertain connections are omitted or dashed.
Main entry points: session.go Session lifecycle · app.go App orchestration · fetch.go Subscription fetch · list_screen.go Terminal UI
Components 24
Client workflow
- CLI entry
cmd/xray-runner/main.go - App orchestration
internal/app/app.go - Terminal UI
internal/tui/list_screen.go
Profiles and config
- Subscription fetch
internal/subscription/fetch.go - Link and profile parsing
internal/subscription/parse.go - Subscription storage
internal/subscription/store.go - Xray config builder
internal/xraycfg/builder.go - Profile config validation
internal/xraycfg/clientparts.go
VPN runtime
- Session lifecycle
internal/app/session.go - Xray process runner
internal/xray/runner.go - Proxy and TUN control
internal/system/proxy.go - Route management
internal/system/route_linux.go - Process split routing
internal/system/split_linux.go - Kill switch
internal/system/nft_linux.go - Connection health
internal/app/health.go
Privileged service
- Privileged service
internal/service/service.go - Service IPC
internal/ipc/client.go - Geo database service
internal/service/geostore.go
Supporting features
- Core and geo updater
internal/updater/updater.go - Config preview and save
internal/app/session.go
Other components
- VPN user
- Xray-core
- VPN provider
- Operating system
Connections 27
- VPN user → CLI entry: starts
README.md - CLI entry → App orchestration: starts client
- VPN user → Terminal UI: chooses subscription
README.md - Terminal UI → App orchestration: selects server
- App orchestration → Subscription fetch: refreshes
- Subscription fetch → VPN provider: fetches links
README.md - Subscription fetch → Link and profile parsing: parses response
- App orchestration → Subscription storage: saves subscriptions
- App orchestration → Xray config builder: builds session config
- Xray config builder → Profile config validation: validates profile parts
- Session lifecycle → Xray process runner: starts and restarts
- Xray process runner → Xray-core: runs
README.md - Session lifecycle → Proxy and TUN control: sets connection mode
- Session lifecycle → Route management: sets TUN routes
README.md - Session lifecycle → Kill switch: enables kill switch
README.md - Session lifecycle → Process split routing: configures process routing
README.md - Session lifecycle → Connection health: checks connection
README.md - Session lifecycle → Terminal UI: shows status
README.md - Session lifecycle → Config preview and save: previews and saves
README.md - Proxy and TUN control → Operating system: changes proxy settings
README.md - Route management → Operating system: changes routes
README.md - Kill switch → Operating system: installs firewall rules
README.md - App orchestration → Service IPC: uses service client
- Service IPC → Privileged service: sends requests
internal/service/service.go - Privileged service → Geo database service: uses geo store
- VPN user → Core and geo updater: requests update
README.md - Core and geo updater → Xray-core: installs core
internal/updater/updater.go