服务器端配置
找个海外的服务器,腾讯云的轻量应用服务器还不错,便宜。
安装sing-box
1
2
3
4git clone -b main https://github.com/SagerNet/sing-box
cd sing-box
./release/local/install_go.sh # 如果已安装 golang 则跳过
./release/local/install.sh编辑配置文件 /usr/local/etc/sing-box/config.json
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{
"log": {
"level": "info",
"timestamp": true
},
"inbounds": [
{
"type": "shadowtls",
"tag": "shadowtls-in",
"listen": "::",
"listen_port": 443,
"sniff": true,
"sniff_override_destination": true,
"detour": "shadowsocks-in",
"version": 3,
"users": [
{
"password": "wqf"
}
],
"handshake": {
"server": "www.lovelive-anime.jp", // 最低标准:国外网站,支持 TLSv1.3, h2
"server_port": 443
},
"strict_mode": true
},
{
"type": "shadowsocks",
"tag": "shadowsocks-in",
"listen": "127.0.0.1",
"method": "2022-blake3-aes-128-gcm",
"password": "anSZAOloDsya14U0qLQccw==" // 执行'openssl rand -base64 16'生成
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
}
]
}启动,下面这个命令会启动服务,输出log,直接关闭也没关系
1
./release/local/enable.sh
更新
1
./release/local/update.sh
客户端配置
因为我本地只有mac,所以只记录mac的安装方式
安装sing-box
1
brew install sing-box
创建配置文件(代理方式)
代理方式只能对浏览器等,可以使用系统代理的程序才有效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{
"log": {
"level": "info",
"timestamp": true
},
"route": {
"rules": [
{
"geosite": [
"cn",
"private"
],
"geoip": [
"cn",
"private"
],
"outbound": "direct"
}
]
},
"inbounds": [
{
"type": "mixed",
"tag": "mixed-in",
"listen": "::",
"listen_port": 10000, //本地代理服务器端口
"sniff": true,
"set_system_proxy": true //直接设置系统代理
}
],
"outbounds": [
{
"type": "shadowsocks",
"tag": "proxy",
"detour": "shadowtls-out",
"method": "2022-blake3-aes-128-gcm",
"password": "anSZAOloDsya14U0qLQccw==",
"udp_over_tcp": {
"enabled": false,
"version": 2
},
"multiplex": {
"enabled": true,
"protocol": "h2mux",
"max_connections": 4,
"min_streams": 4,
"padding": true
}
},
{
"type": "shadowtls",
"tag": "shadowtls-out",
"server": "服务器地址",
"server_port": 443,
"version": 3,
"password": "wqf",
"tls": {
"enabled": true,
"server_name": "www.lovelive-anime.jp",
"utls": {
"enabled": true,
"fingerprint": "chrome"
}
}
},
{
"type": "direct",
"tag": "direct"
}
]
}创建配置文件(tun方式)
tun方式会创建虚拟网卡,所以会对所有程序有效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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163{
"log": {
"level": "info",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "dns_proxy",
"address": "1.1.1.1",
"address_resolver": "dns_direct",
"strategy": "ipv4_only",
"detour": "proxy"
},
{
"tag": "dns_direct",
"address": "223.5.5.5", //阿里的dns服务器
"strategy": "ipv4_only",
"detour": "direct"
},
{
"tag": "dns_block",
"address": "rcode://success"
}
],
"rules": [
{
"geosite": [
"category-ads-all"
],
"server": "dns_block",
"disable_cache": true
},
{
"geosite": [
"geolocation-!cn"
],
"server": "dns_proxy"
},
{
"geosite": [
"cn",
"private"
],
"server": "dns_direct"
},
{
"outbound": [
"any"
],
"server": "dns_direct"
}
]
},
"route": {
"geoip": {
"download_url": "https://github.com/soffchen/sing-geoip/releases/latest/download/geoip.db"
},
"geosite": {
"download_url": "https://github.com/soffchen/sing-geosite/releases/latest/download/geosite.db"
},
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"protocol": [
"quic"
],
"outbound": "block"
},
{
"geosite": [
"category-ads-all"
],
"outbound": "block"
},
{
"geosite": [
"geolocation-!cn"
],
"outbound": "proxy"
},
{
"geosite": [
"cn",
"private"
],
"outbound": "direct"
},
{
"geoip": [
"cn",
"private"
],
"outbound": "direct"
}
],
"auto_detect_interface": true
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"inet4_address": "172.19.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"auto_route": true,
"strict_route": true,
"stack": "system",
"sniff": true,
"sniff_override_destination": false
}
],
"outbounds": [
{
"type": "shadowsocks",
"tag": "proxy",
"detour": "shadowtls-out",
"method": "2022-blake3-aes-128-gcm",
"password": "anSZAOloDsya14U0qLQccw==",
"udp_over_tcp": {
"enabled": false,
"version": 2
},
"multiplex": {
"enabled": true,
"protocol": "h2mux",
"max_connections": 4,
"min_streams": 4,
"padding": true
}
},
{
"type": "shadowtls",
"tag": "shadowtls-out",
"server": "服务器地址",
"server_port": 443,
"version": 3,
"password": "wqf",
"tls": {
"enabled": true,
"server_name": "www.lovelive-anime.jp",
"utls": {
"enabled": true,
"fingerprint": "chrome"
}
}
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
}
]
}