|
| 1 | +#Shadowsocks2022 |
| 2 | + |
| 3 | +Server-side JSON |
| 4 | + |
| 5 | +```json |
| 6 | +{ |
| 7 | + "inbounds": [ |
| 8 | + { |
| 9 | + "port": 1234, |
| 10 | + "protocol": "shadowsocks", |
| 11 | + "settings": { |
| 12 | + "method": "2022-blake3-aes-128-gcm", |
| 13 | + "password": "{{ psk }}", |
| 14 | + "network": "tcp,udp" |
| 15 | + } |
| 16 | + } |
| 17 | + ], |
| 18 | + "outbounds": [ |
| 19 | + { |
| 20 | + "protocol": "freedom" |
| 21 | + } |
| 22 | + ] |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +Server-side JSON (multi-user) |
| 27 | + |
| 28 | +```json |
| 29 | +{ |
| 30 | + "inbounds": [ |
| 31 | + { |
| 32 | + "port": 1234, |
| 33 | + "protocol": "shadowsocks", |
| 34 | + "settings": { |
| 35 | + "method": "2022-blake3-aes-128-gcm", |
| 36 | + "password": "{{ server psk }}", |
| 37 | + "clients": [ |
| 38 | + { |
| 39 | + "password": "{{ user psk }}", |
| 40 | + "email": "my user" |
| 41 | + } |
| 42 | + ], |
| 43 | + "network": "tcp,udp" |
| 44 | + } |
| 45 | + } |
| 46 | + ], |
| 47 | + "outbounds": [ |
| 48 | + { |
| 49 | + "protocol": "freedom" |
| 50 | + } |
| 51 | + ] |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +Server-side JSON (transit) |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "inbounds": [ |
| 60 | + { |
| 61 | + "port": 1234, |
| 62 | + "protocol": "shadowsocks", |
| 63 | + "settings": { |
| 64 | + "method": "2022-blake3-aes-128-gcm", |
| 65 | + "password": "{{ relay psk }}", |
| 66 | + "clients": [ |
| 67 | + { |
| 68 | + "address": "server", |
| 69 | + "port": 1234, |
| 70 | + "password": "{{ server/user psk }}", |
| 71 | + "email": "my server" |
| 72 | + } |
| 73 | + ], |
| 74 | + "network": "tcp,udp" |
| 75 | + } |
| 76 | + } |
| 77 | + ], |
| 78 | + "outbounds": [ |
| 79 | + { |
| 80 | + "protocol": "freedom" |
| 81 | + } |
| 82 | + ] |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +Client JSON |
| 87 | + |
| 88 | +```json |
| 89 | +{ |
| 90 | + "inbounds": [ |
| 91 | + { |
| 92 | + "port": 10801, |
| 93 | + "protocol": "socks", |
| 94 | + "settings": { |
| 95 | + "udp": true |
| 96 | + } |
| 97 | + }, |
| 98 | + { |
| 99 | + "port": 10802, |
| 100 | + "protocol": "http" |
| 101 | + } |
| 102 | + ], |
| 103 | + "outbounds": [ |
| 104 | + { |
| 105 | + "protocol": "shadowsocks", |
| 106 | + "settings": { |
| 107 | + "servers": [ |
| 108 | + { |
| 109 | + "address": "{{ host }}", |
| 110 | + "port": 1234, |
| 111 | + "method": "2022-blake3-aes-128-gcm", |
| 112 | + "password": "{{ psk }}" |
| 113 | + } |
| 114 | + ] |
| 115 | + } |
| 116 | + } |
| 117 | + ] |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +Client JSON (UDP over TCP) |
| 122 | + |
| 123 | +```json |
| 124 | +{ |
| 125 | + "inbounds": [ |
| 126 | + { |
| 127 | + "port": 10801, |
| 128 | + "protocol": "socks", |
| 129 | + "settings": { |
| 130 | + "udp": true |
| 131 | + } |
| 132 | + }, |
| 133 | + { |
| 134 | + "port": 10802, |
| 135 | + "protocol": "http" |
| 136 | + } |
| 137 | + ], |
| 138 | + "outbounds": [ |
| 139 | + { |
| 140 | + "protocol": "shadowsocks", |
| 141 | + "settings": { |
| 142 | + "servers": [ |
| 143 | + { |
| 144 | + "address": "{{ host }}", |
| 145 | + "port": 1234, |
| 146 | + "method": "2022-blake3-aes-128-gcm", |
| 147 | + "password": "{{ psk }}", |
| 148 | + "uot": true |
| 149 | + } |
| 150 | + ] |
| 151 | + } |
| 152 | + } |
| 153 | + ] |
| 154 | +} |
| 155 | +``` |
| 156 | + |
| 157 | +Client JSON (multi-user) |
| 158 | + |
| 159 | +```json |
| 160 | +{ |
| 161 | + "inbounds": [ |
| 162 | + { |
| 163 | + "port": 10801, |
| 164 | + "protocol": "socks", |
| 165 | + "settings": { |
| 166 | + "udp": true |
| 167 | + } |
| 168 | + }, |
| 169 | + { |
| 170 | + "port": 10802, |
| 171 | + "protocol": "http" |
| 172 | + } |
| 173 | + ], |
| 174 | + "outbounds": [ |
| 175 | + { |
| 176 | + "protocol": "shadowsocks", |
| 177 | + "settings": { |
| 178 | + "servers": [ |
| 179 | + { |
| 180 | + "address": "{{ host }}", |
| 181 | + "port": 1234, |
| 182 | + "method": "2022-blake3-aes-128-gcm", |
| 183 | + "password": "{{ server psk }}:{{ user psk }}" |
| 184 | + } |
| 185 | + ] |
| 186 | + } |
| 187 | + } |
| 188 | + ] |
| 189 | +} |
| 190 | +``` |
| 191 | + |
| 192 | +Client JSON (transit) |
| 193 | + |
| 194 | +```json |
| 195 | +{ |
| 196 | + "inbounds": [ |
| 197 | + { |
| 198 | + "port": 10801, |
| 199 | + "protocol": "socks", |
| 200 | + "settings": { |
| 201 | + "udp": true |
| 202 | + } |
| 203 | + }, |
| 204 | + { |
| 205 | + "port": 10802, |
| 206 | + "protocol": "http" |
| 207 | + } |
| 208 | + ], |
| 209 | + "outbounds": [ |
| 210 | + { |
| 211 | + "protocol": "shadowsocks", |
| 212 | + "settings": { |
| 213 | + "servers": [ |
| 214 | + { |
| 215 | + "address": "{{ host }}", |
| 216 | + "port": 1234, |
| 217 | + "method": "2022-blake3-aes-128-gcm", |
| 218 | + "password": "{{ relay psk }}:{{ user psk }}" |
| 219 | + } |
| 220 | + ] |
| 221 | + } |
| 222 | + } |
| 223 | + ] |
| 224 | +} |
| 225 | +``` |
| 226 | + |
| 227 | +## Password |
| 228 | + |
| 229 | +Shadowsocks 2022 uses a pre-shared key similar to WireGuard for the password. |
| 230 | + |
| 231 | +Use `openssl rand -base64 <length>` to generate a shadowsocks-rust compatible key, the length depends on the encryption method used. |
| 232 | + |
| 233 | +| encryption method | key length | |
| 234 | +|--------------------------------|-----:| |
| 235 | +| 2022-blake3-aes-128-gcm | 16 | |
| 236 | +| 2022-blake3-aes-256-gcm | 32 | |
| 237 | +| 2022-blake3-chacha20-poly1305 | 32 | |
| 238 | + |
| 239 | +In the Go implementation, 32-bit keys always work. |
0 commit comments