x-ui和hysteria2协议设置warp

JamesHan Lv2

一、注意事项

  • 本教程不适用于 ARM 架构机器,请自行搜索适配的一键脚本。
  • 推荐使用 Debian 系统,确保 IPv6 支持。

二、安装并配置 WARP

参考官方教程:Cloudflare WARP 安装指南

安装步骤:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 添加 GPG 密钥
curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg

# 添加软件源
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list

# 更新缓存并安装 warp
apt-get update
apt install cloudflare-warp

# 注册 warp
warp-cli register

# 设置为代理模式
warp-cli set-mode proxy

# 修改默认端口(可选)
warp-cli set-proxy-port 16801

# 连接 warp
warp-cli connect

# 验证代理 IP
curl ifconfig.me --proxy socks5://127.0.0.1:16801

三、x-ui 可用配置示例

以下为 x-ui 的 JSON 配置片段,可用于对接 warp 代理:

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
{
"api": {
"services": ["HandlerService", "LoggerService", "StatsService"],
"tag": "api"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
}
],
"outbounds": [
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 16801
}
]
}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"policy": {
"levels": {
"0": {
"handshake": 10,
"connIdle": 100,
"uplinkOnly": 2,
"downlinkOnly": 3,
"statsUserUplink": true,
"statsUserDownlink": true,
"bufferSize": 10240
}
},
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true
}
},
"routing": {
"rules": [
{
"inboundTag": ["api"],
"outboundTag": "api",
"type": "field"
},
{
"ip": ["geoip:private"],
"outboundTag": "blocked",
"type": "field"
},
{
"outboundTag": "blocked",
"protocol": ["bittorrent"],
"type": "field"
}
]
},
"stats": {}
}

四、Hysteria2 可用配置示例

以下为 Hysteria2 的 YAML 配置片段:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
outbounds:
- name: warp
type: socks5
socks5:
addr: 127.0.0.1:16801

- name: v6
type: direct
direct:
mode: 6

acl:
inline:
- v6(::/0)
- warp(0.0.0.0/0)
- direct(all)

  • 标题: x-ui和hysteria2协议设置warp
  • 作者: JamesHan
  • 创建于 : 2025-09-30 17:11:03
  • 更新于 : 2025-10-01 10:24:13
  • 链接: https://blog.ai1314.de/posts/f51ee401.html
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论