v2ray据说是新一代的代理神器,没有用过,只知道相对ss,服务器要求高,而且配置复杂无比.

v2ray没有服务器/客户端区别,只是配置的区别
v2ray配置的整体格式如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"log": {},
"api": {},
"dns": {},
"stats": {},

"routing": {},
"policy": {},

"inbound": {},
"inboundDetour": [],

"outbound": {},
"outboundDetour": [],
"transport": {}
}

json 不支持注释, 评论使用"comment": "",
虽然v2ray开发者有增加注释,实测发现并不能完全解析

log

日志位置以及日志等级

1
2
3
4
5
"log": {
"access": "e:/vmess/log/access.log",
"error": "e:/vmess/log/error.log",
"loglevel": "debug"
},

routing

路由设置,类似firefox的autoproxy/chrome的switchy插件

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
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "blocked"
}
]
}
}
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
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"port": "54-79",
"outboundTag": "direct"
},
{
"type": "field",
"port": "81-442",
"outboundTag": "direct"
},
{
"type": "field",
"port": "444-65535",
"outboundTag": "direct"
},
{
"type": "field",
"domain": [
"gc.kis.scr.kaspersky-labs.com"
],
"outboundTag": "direct"
},
{
"type": "chinasites",
"outboundTag": "direct"
},
{
"type": "field",
"domain": [
"google.com"
],
"outboundTag": "ss_web"
},
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "direct"
},
{
"type": "chinaip",
"outboundTag": "direct"
}
]
}
}

inbound / inboundDetour

接收传入的数据

inbound是配置主入口,必须有配置
inboundDetour是配置剩余的入口,为列表

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
"inbound": {
"port": 10086,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "299c53c1-20bf-598b-c97c-771dabb62a21",
"level": 1,
"alterId": 64
}
]
},
"streamSettings": {
"network": "kcp"
},
"detour": {
"to": "vmess-detour-310971"
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"port": 1089,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
{
"port": 3128,
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"timeout": 0
}
},
{
"protocol": "vmess",
"port": "10000-20000",
"tag": "vmess-detour-310971",
"settings": {},
"allocate": {
"strategy": "random",
"concurrency": 5,
"refresh": 5
},
"streamSettings": {
"network": "kcp"
}
},
{
"port": 10087,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "299c53c1-20bf-598b-c97c-771dabb62a21",
"level": 1,
"alterId": 64
}
]
}
},
{
"protocol": "shadowsocks",
"port": 20001,
"settings": {
"method": "aes-256-cfb",
"password": "dasfdsafdfs",
"udp": true,
"level": 1
}
}
],

outbound / outboundDetour

数据的请求地址

参考文档

  1. [https://www.v2ray.com/chapter_02/]