This file is indexed.

/usr/share/doc/shadowsocks-libev/shadowsocks-libev.html is in shadowsocks-libev 3.1.3+ds-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>shadowsocks-libev(8)</title>
</head>
<body>
<h1>shadowsocks-libev(8)</h1>
<p>
</p>
<hr>
<h2><a name="_name"></a>NAME</h2>
<p>shadowsocks-libev - a lightweight and secure socks5 proxy</p>
<hr>
<h2><a name="_synopsis"></a>SYNOPSIS</h2>
<p><strong>ss-local</strong>|<strong>ss-redir</strong>|<strong>ss-server</strong>|<strong>ss-tunnel</strong>|<strong>ss-manager</strong>
 [-s <emphasis>&lt;server_host&gt;</emphasis>] [-p <emphasis>&lt;server_port&gt;</emphasis>] [-l <emphasis>&lt;local_port&gt;</emphasis>] [-k <emphasis>&lt;password&gt;</emphasis>]
 [-m <emphasis>&lt;encrypt_method&gt;</emphasis>] [-f <emphasis>&lt;pid_file&gt;</emphasis>] [-t <emphasis>&lt;timeout&gt;</emphasis>] [-c <emphasis>&lt;config_file&gt;</emphasis>]</p>
<hr>
<h2><a name="_description"></a>DESCRIPTION</h2>
<p><strong>Shadowsocks-libev</strong> is a lightweight and secure socks5 proxy.
It is a port of the original shadowsocks created by clowwindy.
<strong>Shadowsocks-libev</strong> is written in pure C and takes advantage of <strong>libev</strong>
to achieve both high performance and low resource consumption.</p>
<p><strong>Shadowsocks-libev</strong> consists of five components. One is <code>ss-server</code>(1)
that runs on a remote server to provide secured tunnel service.
<code>ss-local</code>(1) and <code>ss-redir</code>(1) are clients on your local machines to proxy
traffic(TCP/UDP or both).
<code>ss-tunnel</code>(1) is a tool for local port forwarding.</p>
<p>While <code>ss-local</code>(1) works as a standard socks5 proxy, <code>ss-redir</code>(1) works
as a transparent proxy and requires netfilter&#8217;s NAT module. For more
information, check out the <em>EXAMPLE</em> section.</p>
<p><code>ss-manager</code>(1) is a controller for multi-user management and traffic
statistics, using UNIX domain socket to talk with <code>ss-server</code>(1).
Also, it provides a UNIX domain socket or IP based API for other software.
About the details of this API, please refer to the <em>PROTOCOL</em> section.</p>
<hr>
<h2><a name="_options"></a>OPTIONS</h2>
<dl>
<dt>
-s <emphasis>&lt;server_host&gt;</emphasis>
</dt>
<dd>
<p>
Set the server&#8217;s hostname or IP.
</p>
</dd>
<dt>
-l <emphasis>&lt;local_port&gt;</emphasis>
</dt>
<dd>
<p>
Set the local port number.
</p>
<p>Not available in server nor manager mode.</p>
</dd>
<dt>
-k <emphasis>&lt;password&gt;</emphasis>
</dt>
<dt>
--password <emphasis>&lt;password&gt;</emphasis>
</dt>
<dd>
<p>
Set the password. The server and the client should use the same password.
</p>
</dd>
<dt>
--key <emphasis>&lt;key_in_base64&gt;</emphasis>
</dt>
<dd>
<p>
Set the key directly. The key should be encoded with URL-safe Base64.
</p>
<p>Not available in manager mode.</p>
</dd>
<dt>
-m <emphasis>&lt;encrypt_method&gt;</emphasis>
</dt>
<dd>
<p>
Set the cipher.
</p>
<p><strong>Shadowsocks-libev</strong> accepts 18 different ciphers:</p>
<p>aes-128-gcm, aes-192-gcm, aes-256-gcm,
rc4-md5, aes-128-cfb, aes-192-cfb, aes-256-cfb,
aes-128-ctr, aes-192-ctr, aes-256-ctr, bf-cfb,
camellia-128-cfb, camellia-192-cfb, camellia-256-cfb,
chacha20-ietf-poly1305, salsa20, chacha20 and chacha20-ietf.</p>
<p>The default cipher is <em>rc4-md5</em>.</p>
<p>If built with PolarSSL or custom OpenSSL libraries, some of
these ciphers may not work.</p>
</dd>
<dt>
-a <emphasis>&lt;user_name&gt;</emphasis>
</dt>
<dd>
<p>
Run as a specific user.
</p>
</dd>
<dt>
-f <emphasis>&lt;pid_file&gt;</emphasis>
</dt>
<dd>
<p>
Start shadowsocks as a daemon with specific pid file.
</p>
</dd>
<dt>
-t <emphasis>&lt;timeout&gt;</emphasis>
</dt>
<dd>
<p>
Set the socket timeout in seconds. The default value is 60.
</p>
</dd>
<dt>
-c <emphasis>&lt;config_file&gt;</emphasis>
</dt>
<dd>
<p>
Use a configuration file.
</p>
</dd>
<dt>
-n <emphasis>&lt;number&gt;</emphasis>
</dt>
<dd>
<p>
Specify max number of open files.
</p>
<p>Not available in manager mode.</p>
<p>Only available on Linux.</p>
</dd>
<dt>
-i <emphasis>&lt;interface&gt;</emphasis>
</dt>
<dd>
<p>
Send traffic through specific network interface.
</p>
<p>For example, there are three interfaces in your device, which is
lo (127.0.0.1), eth0 (192.168.0.1) and eth1 (192.168.0.2).
Meanwhile, you configure <strong>shadowsocks-libev</strong> to listen on 0.0.0.0:8388
and bind to eth1. That results the traffic go out through eth1,
but not lo nor eth0. This option is useful to control traffic in
multi-interface environment.</p>
<p>Not available in redir mode.</p>
</dd>
<dt>
-b <emphasis>&lt;local_address&gt;</emphasis>
</dt>
<dd>
<p>
Specify local address to bind.
</p>
<p>Not available in server nor manager mode.</p>
</dd>
<dt>
-u
</dt>
<dd>
<p>
Enable UDP relay.
</p>
<p>TPROXY is required in redir mode. You may need root permission.</p>
</dd>
<dt>
-U
</dt>
<dd>
<p>
Enable UDP relay and disable TCP relay.
</p>
<p>Not available in local mode.</p>
</dd>
<dt>
-L <emphasis>&lt;addr:port&gt;</emphasis>
</dt>
<dd>
<p>
Specify destination server address and port for local port forwarding.
</p>
<p>Only available in tunnel mode.</p>
</dd>
<dt>
-d <emphasis>&lt;addr&gt;</emphasis>
</dt>
<dd>
<p>
Setup name servers for internal DNS resolver (libudns).
The default server is fetched from /etc/resolv.conf.
</p>
<p>Only available in server and manager mode.</p>
</dd>
<dt>
--fast-open
</dt>
<dd>
<p>
Enable TCP fast open.
</p>
<p>Not available in redir nor tunnel mode, with Linux kernel &gt; 3.7.0.</p>
</dd>
<dt>
--reuse-port
</dt>
<dd>
<p>
Enable port reuse.
</p>
<p>Only available with Linux kernel &gt; 3.9.0.</p>
</dd>
<dt>
--no-delay
</dt>
<dd>
<p>
Enable TCP_NODELAY.
</p>
</dd>
<dt>
--acl <emphasis>&lt;acl_config&gt;</emphasis>
</dt>
<dd>
<p>
Enable ACL (Access Control List) and specify config file.
</p>
<p>Not available in redir nor tunnel mode.</p>
</dd>
<dt>
--manager-address <emphasis>&lt;path_to_unix_domain&gt;</emphasis>
</dt>
<dd>
<p>
Specify UNIX domain socket address.
</p>
<p>Only available in server and manager mode.</p>
</dd>
<dt>
--executable <emphasis>&lt;path_to_server_executable&gt;</emphasis>
</dt>
<dd>
<p>
Specify the executable path of <code>ss-server</code>.
</p>
<p>Only available in manager mode.</p>
</dd>
<dt>
-v
</dt>
<dd>
<p>
Enable verbose mode.
</p>
</dd>
<dt>
-h|--help
</dt>
<dd>
<p>
Print help message.
</p>
</dd>
</dl>
<hr>
<h2><a name="_config_file"></a>CONFIG FILE</h2>
<p>The config file is written in JSON and easy to edit.</p>
<p>The config file equivalent of command line options is listed as example below.</p>
<div>
<table rules="all"
width="100%"
frame="hsides"
cellspacing="0" cellpadding="4">
<thead>
<tr>
<th align="left" width="50%" valign="top"> Command line                        </th>
<th align="left" width="50%" valign="top"> JSON</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" width="50%" valign="top"><p>-s some.server.net</p></td>
<td align="left" width="50%" valign="top"><p>"server": "some.server.net"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-s some.server.net -p 1234 (client)</p></td>
<td align="left" width="50%" valign="top"><p>"server": "some.server.net:1234"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-p 1234</p></td>
<td align="left" width="50%" valign="top"><p>"server_port": "1234"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-b 0.0.0.0</p></td>
<td align="left" width="50%" valign="top"><p>"local_address": "0.0.0.0"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-l 4321</p></td>
<td align="left" width="50%" valign="top"><p>"local_port": "4321"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-k "PasSworD"</p></td>
<td align="left" width="50%" valign="top"><p>"password": "PasSworD"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-m "aes-256-cfb"</p></td>
<td align="left" width="50%" valign="top"><p>"method": "aes-256-cfb"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-t 60</p></td>
<td align="left" width="50%" valign="top"><p>"timeout": 60</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-a nobody</p></td>
<td align="left" width="50%" valign="top"><p>"user": "nobody"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>--fast-open</p></td>
<td align="left" width="50%" valign="top"><p>"fast_open": true</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>--reuse-port</p></td>
<td align="left" width="50%" valign="top"><p>"reuse_port": true</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>--no-delay</p></td>
<td align="left" width="50%" valign="top"><p>"no_delay": true</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>--plugin "obfs-server"</p></td>
<td align="left" width="50%" valign="top"><p>"plugin": "obfs-server"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>--plugin-opts "obfs=http"</p></td>
<td align="left" width="50%" valign="top"><p>"plugin_opts": "obfs=http"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-6</p></td>
<td align="left" width="50%" valign="top"><p>"ipv6_first": true</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-n "/etc/nofile"</p></td>
<td align="left" width="50%" valign="top"><p>"nofile": "/etc/nofile"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-d "8.8.8.8"</p></td>
<td align="left" width="50%" valign="top"><p>"nameserver": "8.8.8.8"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-L "somedns.net:53"</p></td>
<td align="left" width="50%" valign="top"><p>"tunnel_address": "somedns.net:53"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-u</p></td>
<td align="left" width="50%" valign="top"><p>"mode": "tcp_and_udp"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>-U</p></td>
<td align="left" width="50%" valign="top"><p>"mode": "udp_only"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>no "-u" nor "-U" options (default)</p></td>
<td align="left" width="50%" valign="top"><p>"mode": "tcp_only"</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p>(only in ss-manager&#8217;s config)</p></td>
<td align="left" width="50%" valign="top"><p>"port_password": {"1234":"PasSworD"}</p></td>
</tr>
</tbody>
</table>
</div>
<hr>
<h2><a name="_example"></a>EXAMPLE</h2>
<p><code>ss-redir</code> requires netfilter&#8217;s NAT function. Here is an example:</p>
<pre><code># Create new chain
root@Wrt:~# iptables -t nat -N SHADOWSOCKS
root@Wrt:~# iptables -t mangle -N SHADOWSOCKS

# Ignore your shadowsocks server's addresses
# It's very IMPORTANT, just be careful.
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN

# Ignore LANs and any other addresses you'd like to bypass the proxy
# See Wikipedia and RFC5735 for full list of reserved networks.
# See ashi009/bestroutetb for a highly optimized CHN route list.
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN

# Anything else should be redirected to shadowsocks's local port
root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345

# Add any UDP rules
root@Wrt:~# ip rule add fwmark 0x01/0x01 table 100
root@Wrt:~# ip route add local 0.0.0.0/0 dev lo table 100
root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01

# Apply the rules
root@Wrt:~# iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS

# Start the shadowsocks-redir
root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid</code></pre>
<hr>
<h2><a name="_protocol"></a>PROTOCOL</h2>
<dl>
<dt>
<code>ss-manager</code>(1) provides several APIs through UDP protocol
</dt>
<dd>
<dl>
<dt>
Send UDP commands in the following format to the manager-address provided to ss-manager(1): 
</dt>
<dd>
<p>
 command: [JSON data]
</p>
</dd>
<dt>
To add a port: 
</dt>
<dd>
<p>
 add: {"server_port": 8001, "password":"7cd308cc059"}
</p>
</dd>
<dt>
To remove a port: 
</dt>
<dd>
<p>
 remove: {"server_port": 8001}
</p>
</dd>
<dt>
To receive a pong: 
</dt>
<dd>
<p>
 ping
</p>
</dd>
<dt>
Then <code>ss-manager</code>(1) will send back the traffic statistics: 
</dt>
<dd>
<p>
 stat: {"8001":11370}
</p>
</dd>
</dl>
</dd>
</dl>
<hr>
<h2><a name="_see_also"></a>SEE ALSO</h2>
<p><code>ss-local</code>(1),
<code>ss-server</code>(1),
<code>ss-tunnel</code>(1),
<code>ss-redir</code>(1),
<code>ss-manager</code>(1),
<code>iptables</code>(8),
/etc/shadowsocks-libev/config.json</p>
<p></p>
<p></p>
<hr><p><small>
Last updated
 2018-01-16 01:25:03 UTC
</small></p>
</body>
</html>