安装Xray

https://github.com/XTLS/Xray-install

1
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

用于在支持 systemd 的操作系统

默认配置文件

使用xray uuid xray x25519 生成

/usr/local/etc/xray/config.json

VLESS-Vision-REALITY(防偷模板)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
    "log": {
        "loglevel": "debug"
    },
    "inbounds": [
        {
            "listen": "127.0.0.1",
            "tag": "dokodemo-in",
            "port": 54321, // 任意空闲端口,如果要自己修改记得这里和下面的 reality 入站 dest 要同步修改
            "protocol": "dokodemo-door",
            "settings": {
                // reality dest 的实际设置位置 和普通 reality 要求相同
                "address": "www.amd.com",
                "port": 443,
                "network": "tcp"
            },
            "sniffing": { // 这里的 sniffing 不是多余的,别乱动
                "enabled": true,
                "destOverride": [
                    "tls"
                ],
                "routeOnly": true
            }
        },
        {
            "listen": "0.0.0.0",
            "port": 54321,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "", //xray uuid
                        "flow":"xtls-rprx-vision"
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "tcp",
                "security": "reality",
                "realitySettings": {
                    // 指向前面设置的 dokodemo-door 入站
                    "dest": "www.amd.com:443",
                    // serverNames 仍然需要在这里正常填写
                    "serverNames": [
                        "www.amd.com"
                    ],
                    "privateKey": "", // 运行 `xray x25519` 生成
                    "shortIds": [
                        "",
                        "0123456789abcdef"
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ],
                "routeOnly": true
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ],
    "routing": {
        "rules": [
            {
                "inboundTag": [
                    "dokodemo-in"
                ],
                // 重要,这个域名列表需要和 realitySettings 的 serverNames 保持一致
                "domain": [
                    "www.amd.com"
                ],
                "outboundTag": "direct"
            },
            {
                "inboundTag": [
                    "dokodemo-in"
                ],
                "outboundTag": "block"
            }
        ]
    }
}

Xray-examples

https://github.com/XTLS/Xray-examples/tree/main/