Sam's Notes | Sam Blog

梦想还是要有的,万一实现了呢

0%

ss

v 2 r a y

v2ray 安装

1
2
3
4
5
6
7
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh

# 安裝最新發行的 geoip.dat 和 geosite.dat
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)

# 移除 V2Ray
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove

安装结果

1
2
3
4
5
6
7
8
9
10
installed: /usr/local/bin/v2ray
installed: /usr/local/bin/v2ctl
installed: /usr/local/share/v2ray/geoip.dat
installed: /usr/local/share/v2ray/geosite.dat
installed: /usr/local/etc/v2ray/config.json
installed: /var/log/v2ray/
installed: /var/log/v2ray/access.log
installed: /var/log/v2ray/error.log
installed: /etc/systemd/system/v2ray.service
installed: /etc/systemd/system/v2ray@.service

server 配置

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
{
"inbounds": [{
"port": ###, # 端口
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "###", # 可以使用/usr/bin/v2ray/v2ctl uuid生成
"level": 1,
"alterId": 0
}
]
},
"streamSettings": { # 载体配置段,设置为websocket
"network": "ws",
"wsSettings": {
"path": "/###" # 与nginx中的路径保持一致
}
},
"listen": "127.0.0.1" # 出于安全考虑,建议只接受本地链接
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}

client 配置

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
{
"inbounds":[
{
"port":1080,
"listen":"127.0.0.1",
"protocol":"socks",
"settings":{
"udp":true
}
}
],
"outbounds":[
{
"protocol":"vmess",
"settings":{
"vnext":[
{
"address":"###", # IP
"port":443,
"users":[
{
"alterId":0, ### alterId
"encryption":"",
"flow":"",
"id":"###", ### id
"level":8,
"security":"auto"
}
]
}
]
},
"streamSettings":{
"network":"ws",
"security":"tls",
"tlsSettings":{
"allowInsecure":true,
"serverName":"###" ### 域名
},
"wsSettings":{
"headers":{
"Host":"###" ### 域名
},
"path":"###" ### path
}
}
},
{
"protocol":"freedom",
"tag":"direct"
}
],
"routing":{
"domainStrategy":"IPOnDemand",
"rules":[
{
"type":"field",
"ip":[
"geoip:private"
],
"outboundTag":"direct"
}
]
}
}

启动

1
2
3
4
systemctl enable v2ray

systemctl start v2ray