Skip to content

Architecture

v2rayroot edited this page Jun 14, 2026 · 1 revision

Architecture

V2Root Core is compiled with Go -buildmode=c-shared. The resulting DLL or shared object embeds Xray-core and exports a flat C ABI.

Functional Layers

Layer Responsibilities
Runtime Start, stop, and report the state of one embedded Xray instance
Configuration Parse share URIs, validate Xray JSON, and generate share URIs
Operations Latency tests, traffic metrics, logs, geo assets, and metadata

Process Model

The library stores runtime state globally. A process can host one active Xray instance. Loading the same binary more than once does not create independent engines.

Use separate operating-system processes when isolated concurrent engines are required.

Local Proxy Model

Parsed configurations create:

  • HTTP proxy, default port 10809
  • SOCKS proxy, default port 10808

The host application configures its own traffic or system proxy settings to use these endpoints. V2Root Core does not manage TUN or VPN interfaces.

Internal Stats Service

At startup, the library allocates an available loopback port, enables Xray StatsService, injects API routing, and queries metrics through internal gRPC. The service binds to 127.0.0.1 and should never be exposed externally.

Related Pages

Clone this wiki locally