English
First config
A VLESS + REALITY server on a VPS and a client for it: one inbound, one outbound and a route on each side. REALITY needs no domain and no certificate: to anyone without the key the server looks like a real site.
How the file is laid out
The configuration is one YAML file. inbounds accept connections, outbounds send them, route decides which outbound a connection takes. Inbounds and outbounds are maps: the key is the name (tag), inside it the protocol is the key of the block. Every section is in Configuration.
Keys
On any machine with ours:
sh
ours generate reality-keypair # PrivateKey for the server, PublicKey for the client
ours generate uuid # the user's uuid
ours generate rand 8 --hex # short_idFor handshake.server and sni pick someone else's site with TLS 1.3 that the client can reach, not your own domain.
Server
/etc/ours/config.yaml:
yaml
inbounds:
vless-in:
vless:
listen: ":443"
users:
- name: alice
uuid: 88a58c49-bc95-4797-835b-883e345536d5
flow: xtls-rprx-vision
tls:
sni: www.example.com
reality:
handshake:
server: www.example.com:443
private_key: gDYKEVP_HyaNvNgoRnAUMw7XBbTY9YPyFjJVuGcNm34
short_id: [2c97154e0c1ce004]
outbounds:
direct:
direct:
route:
final:
outbound: directClient
A local SOCKS5 and HTTP proxy on port 1080 that sends everything to the server:
yaml
inbounds:
local:
mixed:
listen: 127.0.0.1:1080
outbounds:
proxy:
vless:
server: vpn.example.com:443
uuid: 88a58c49-bc95-4797-835b-883e345536d5
flow: xtls-rprx-vision
tls:
sni: www.example.com
utls:
fingerprint: chrome
reality:
public_key: 7r2W5J3jxGzHWeG2i3PcD3w9hZNkQzrCiyyCgWn4LTc
short_id: 2c97154e0c1ce004
route:
final:
outbound: proxyserver is the address of your VPS; uuid, sni and short_id are the same as on the server, public_key is the pair of the server's private_key. Either side can be sing-box or Xray with the same values.
Check and run
sh
ours check -c config.yaml # reads the file, opens nothing
ours run -c config.yaml
curl -x socks5h://127.0.0.1:1080 https://www.example.com/check names the line and column of a mistake. On the server, open 443/tcp in the firewall and run ours as a service (Install).
Next
- Examples: a server with a fallback protocol, a router, a client with a subscription.
- Routing: which connections go through the proxy and which go direct.
- Troubleshooting, if connections do not go through.