What it is
An open-source platform for encrypted tunnels over HTTPS and TLS with flexible routing rules. Protocols VLESS, VMess, Trojan; transports TCP, WebSocket, gRPC and XHTTP.
How we use it
Where a tunnel should share port 443 and a domain with a website behind nginx, or traffic must be split by rules between several servers.
What it is in plain words
Xray (Xray-core) is an open-source program for building encrypted tunnels between a client and a server, or between servers. It grew out of the V2Ray project in 2020 and is written in Go. Its strength is that traffic travels over standard HTTPS and TLS, so a tunnel can share port 443 and a domain with an ordinary website, and routing rules decide which traffic goes where.
Where it helps a business
- Services on different servers need an encrypted channel between them that goes over the usual HTTPS port, without opening extra ports.
- Staff need access to internal systems through one entry point that also serves the company website behind nginx.
- Traffic must be split by rules: some destinations through one server, others through another, the rest direct.
- Access is issued to many users, and a panel such as Marzban or Remnawave should manage it.
How it is built
- Inbounds and outbounds. An inbound accepts connections (on the server, or locally on a client device), an outbound sends traffic further: to another server, direct to the internet, or nowhere.
- Protocols. VLESS is the main one, a light protocol with authentication by UUID. Also supported: VMess, Trojan, Shadowsocks.
- Transports. The same protocol can travel over plain TCP, WebSocket, gRPC or XHTTP. WebSocket and XHTTP work through an ordinary web server, so nginx can accept them on the same domain as the website.
- Security layer. TLS with your own domain and certificate, or Reality, which needs neither.
- Routing. Rules by domain, IP address, port or protocol decide which outbound takes the traffic. Domain and IP lists can be connected as ready rule sets.
- API. A running Xray can be managed over gRPC: add and remove users, read traffic statistics, without a restart.
Xray and sing-box
| Xray | sing-box |
|---|
| Origin | fork of V2Ray, the XTLS project | a separate project, written from scratch |
| Strengths | VLESS, Reality and XHTTP first, a large server user base | many protocols, including Hysteria2 and TUIC, TUN mode on devices |
| Where it is used | servers, panels, clients | mostly client apps, also servers |
| Configuration | JSON, the V2Ray tradition | JSON with its own structure and rule sets |
Both are written in Go and share the key protocols, so a client app can carry both engines and switch between them. More in sing-box.
Common mistakes
- An old client for a new server. Xray evolves quickly, and a fresh server option may be unknown to an older client. Versions of the server, the clients and the panel are updated together.
- Panel and core versions. Panels pin the core versions they support; installing a newer Xray by hand can break the panel.
- One entry point. If the only inbound stops working, every user is cut off. Keep two or three inbounds of different types.
- Logs that eat the disk. Access logs at a detailed level grow fast on a busy server; the level and rotation are set from the start.
- Exposed management. The gRPC API and the panel admin must listen only on internal addresses or behind a separate tunnel.
When you do not need it
If you only need to link an office with servers or give staff access to internal systems, WireGuard is simpler and faster. Xray is justified when traffic must go over HTTPS, share a port with a website, or follow complex routing rules.