V2RAY性能调优

最近在github上发现了个牛逼到不行的v2ray调优的帖子,配置好后速度和延迟翻了整整6倍,记录一下 搬瓦工CN2机房下载速度大概在10MB/s左右,youtube 4k不卡

配置

V2RAY

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
{
"inbounds": [
{
"port": 12345,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": false,
"userLevel": 999
},
"streamSettings": {
"network":"ws",
"wsSettings": {
"path":"/afpizxcnjqnv99f3234jz7624inx78123n"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

NGINX

这里只是把我的配置粘过来了,证书和listen 443 可以先不用设置,后期用certbot自动挂即可

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
server {
server\_name test.domin.com;
location / {
root/www/webpath;
index index.html index.htm;
}
error\_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location /afpizxcnjqnv99f3234jz7624inx78123n{
proxy\_redirect off;
proxy\_pass http://127.0.0.1:12345;
proxy\_http\_version 1.1;
proxy\_set\_header Upgrade $http\_upgrade;
proxy\_set\_header Connection "upgrade";
proxy\_set\_header Host $host;
proxy\_set\_header X-Real-IP $remote\_addr;
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;
}
listen 443 ssl; # managed by Certbot
ssl\_certificate /etc/letsencrypt/live/test.domin.com/fullchain.pem; # managed by Certbot
ssl\_certificate\_key /etc/letsencrypt/live/test.domin.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl\_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = test.domin.com) {
return 301 https://$host$request\_uri;
} # managed by Certbot

server\_name test.domin.com;
listen 80;
return 404; # managed by Certbot

}

客户端

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
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"listen": "0.0.0.0",
"port": 10808,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth",
"userLevel": 10,
"udp": true
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"udp": false,
"allowTransparent": false
}
}
],
"outbounds": [
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "test.domin.com",
"level": 10,
"port": 443
}
]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "/afpizxcnjqnv99f3234jz7624inx78123n"
}
},
"mux": {
"enabled": true,
"concurrency": 8
}
}
]
}

把客户端的配置保存为socks.json,使用v2rayN中的–添加自定义配置服务器 

加载配置文件即可使用 github原始讨论帖