1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-28 10:15:23 +00:00
v2fly/spec/guide.md
2015-10-19 10:33:11 +02:00

96 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# V2Ray 简明教程
## 工作机制
你需要至少两个 V2Ray Server设为 A、B才可以正常穿墙。以网页浏览为例你的浏览器和 A 以 Socks 5 协议通信B 和目标网站之间以 HTTP 协议通信A 和 B 之间使用 V2Ray 的自有协议 [VMess](https://github.com/V2Ray/v2ray-core/blob/master/spec/vmess.md) 通信,如下图:
![](https://github.com/V2Ray/v2ray-core/blob/master/spec/v2ray.png)
通常 Server A 运行在你自己的电脑Server B 运行在一台海外的 VPS 中。
## 安装 V2Ray Server
[安装 V2Ray](https://github.com/V2Ray/v2ray-core/blob/master/spec/install.md)
## 配置 V2Ray Server
### Server A
示例配置保存于 [vpoint_socks_vmess.json](https://github.com/v2ray/v2ray-core/blob/master/release/config/vpoint_socks_vmess.json) 文件中,格式如下:
```javascript
{
"port": 1080, // 监听端口
"log" : {
"access": "" // 访问记录,目前只在服务器端有效,这里留空
},
"inbound": {
"protocol": "socks", // 传入数据所用协议
"settings": {
"auth": "noauth", // 认证方式,暂时只支持匿名
"udp": false, // 如果要使用 UDP 转发,请改成 true
"ip": "127.0.0.1" // 如果 Server A 不是运行在本地,请标明 Server A 的实际 IP 地址,否则 UDP 转发将无法进行。
}
},
"outbound": {
"protocol": "vmess", // 中继协议,暂时只有这个
"settings": {
"vnext": [
{
"address": "127.0.0.1", // Server B 的 IP 地址IPv4 或 IPv6不支持域名
"port": 27183, // Server B 的监听端口,请更换成其它的值
"users": [
// 用户 ID必须包含在 Server B 的配置文件中。此 ID 将被用于通信的认证,请自行更换随机的 ID可以使用 https://www.uuidgenerator.net/ 来生成新的 ID。
{"id": "ad937d9d-6e23-4a5a-ba23-bce5092a7c51"}
],
"network": "tcp" // 如果要使用 UDP 转发,请改成 "tcp,udp"
}
]
}
}
}
```
### Server B
示例配置保存于 [vpoint_vmess_freedom.json](https://github.com/v2ray/v2ray-core/blob/master/release/config/vpoint_vmess_freedom.json) 文件中,格式如下:
```javascript
{
"port": 27183, // 监听端口,必须和 Server A 中指定的一致
"log" : {
"access": "access.log" // 访问记录
},
"inbound": {
"protocol": "vmess", // 中继协议,不用改
"settings": {
"clients": [
// 认可的用户 ID必须包含 Server A 中的用户 ID
{"id": "ad937d9d-6e23-4a5a-ba23-bce5092a7c51"}
],
"udp": false // 如果要使用 UDP 转发,请改成 true
}
},
"outbound": {
"protocol": "freedom", // 出口协议,不用改
"settings": {} // 暂无配置
}
}
```
### 其它
* V2Ray 的用户验证基于时间,请确保 A 和 B 所在机器的系统时间误差在一分钟以内。
* json 配置文件实际上不支持注释(即“//”之后的部分,在使用时请务必删去)。
## 运行
Server A
./server --config="vpoint_socks_vmess.json 的绝对路径"
Server B
./server --config="vpoint_vmess_freedom.json 的绝对路径"
## 测试服务器可用性
curl -v --socks5-hostname 127.0.0.1:1080 https://www.google.com/
## 调试
使用过程中遇到任何问题,请参考[错误信息](https://github.com/V2Ray/v2ray-core/blob/master/spec/errors.md)。