You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

258 lines
7.7 KiB

11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
  1. .ig
  2. . manual page for shadowsocks-libev
  3. .
  4. . Copyright (c) 2012-2016, by: Max Lv
  5. . All rights reserved.
  6. .
  7. . Permission is granted to copy, distribute and/or modify this document
  8. . under the terms of the GNU Free Documentation License, Version 1.1 or
  9. . any later version published by the Free Software Foundation;
  10. . with no Front-Cover Texts, no Back-Cover Texts, and with the following
  11. . Invariant Sections (and any sub-sections therein):
  12. . all .ig sections, including this one
  13. . STUPID TRICKS Sampler
  14. . AUTHOR
  15. .
  16. . A copy of the Free Documentation License is included in the section
  17. . entitled "GNU Free Documentation License".
  18. .
  19. ..
  20. \# - these two are for chuckles, makes great grammar
  21. .ds Lo \fBss-local\fR
  22. .ds Re \fBss-redir\fR
  23. .ds Se \fBss-server\fR
  24. .ds Tu \fBss-tunnel\fR
  25. .ds Ma \fBss-manager\fR
  26. .ds Me \fBShadowsocks-libev\fR
  27. .
  28. .TH "SHADOWSOCKS-LIBEV" "8" "April 19, 2016" "SHADOWSOCKS-LIBEV"
  29. .SH NAME
  30. shadowsocks-libev \- a lightweight and secure socks5 proxy
  31. .SH SYNOPSIS
  32. \*(Lo|\*(Re|\*(Se|\*(Tu|\*(Ma
  33. [\fB\-s\fR \fIserver_host\fR] [\fB\-p\fR \fIserver_port\fR]
  34. [\fB\-l\fR \fIlocal_port\fR] [\fB\-k\fR \fIpassword\fR]
  35. [\fB\-m\fR \fIencrypt_method\fR] [\fB\-f\fR \fIpid_file\fR]
  36. [\fB\-t\fR \fItimeout\fR] [\fB\-c\fR \fIconfig_file\fR]
  37. .SH DESCRIPTION
  38. \*(Me is a lightweight and secure socks5 proxy. It is a port of the original
  39. shadowsocks created by clowwindy. \*(Me is written in pure C and takes advantage
  40. of \fBlibev\fP to achieve both high performance and low resource consumption.
  41. .PP
  42. \*(Me consists of five components. One is \*(Se(1) that runs on a remote server
  43. to provide secured tunnel service. \*(Lo(1) and \*(Re(1) are clients on your
  44. local machines to proxy TCP traffic. \*(Tu(1) is a tool for local port
  45. forwarding.
  46. .PP
  47. While \*(Lo(1) works as a standard socks5 proxy, \*(Re(1) works as a transparent
  48. proxy and requires netfilter's NAT module. For more information, check out the
  49. example section.
  50. .PP
  51. \*(Ma(1) is a controller for multi-user management and traffic statistics, using
  52. UNIX domain socket to talk with \*(Se(1). Also, it provides a UNIX domain socket
  53. or IP based API for other software. About the details of this API, please refer
  54. to the protocol section.
  55. .SH OPTIONS
  56. .TP
  57. .B \-s \fIserver_host\fP
  58. Set the server's hostname or IP.
  59. .TP
  60. .B \-p \fIserver_port\fP
  61. Set the server's port number.
  62. Not available in manager mode.
  63. .TP
  64. .B \-l \fIlocal_port\fP
  65. Set the local port number.
  66. Not available in server nor manager mode.
  67. .TP
  68. .B \-k \fIpassword\fP
  69. Set the password. The server and the client should use the same password.
  70. .TP
  71. .B \-m \fIencrypt_method\fP
  72. Set the cipher.
  73. \*(Me accepts 18 different ciphers: table, rc4, rc4-md5, aes-128-cfb,
  74. aes-192-cfb, aes-256-cfb, bf-cfb, camellia-128-cfb, camellia-192-cfb,
  75. camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb, rc2-cfb, seed-cfb, salsa20,
  76. chacha20 and chacha20-ietf. The default cipher is \fItable\fP.
  77. If built with PolarSSL or custom OpenSSL libraries, some of these ciphers may
  78. not work.
  79. .TP
  80. .B \-a \fIuser_name\fP
  81. Run as a specific user.
  82. .TP
  83. .B \-f \fIpid_file\fP
  84. Start shadowsocks as a daemon with specific pid file.
  85. .TP
  86. .B \-t \fItimeout\fP
  87. Set the socket timeout in seconds. The default value is 60.
  88. .TP
  89. .B \-c \fIconfig_file\fP
  90. Use a configuration file.
  91. .TP
  92. .B \-n \fInumber\fP
  93. Specify max number of open files.
  94. Not available in manager mode.
  95. Only available on Linux.
  96. .TP
  97. .B \-i \fIinterface\fP
  98. Send traffic through specific network interface.
  99. For example, there are three interfaces in your device, which is lo (127.0.0.1),
  100. eth0 (192.168.0.1) and eth1 (192.168.0.2). Meanwhile, you configure
  101. \fBshadowsocks-libev\fR to listen on 0.0.0.0:8388 and bind to eth1. That results
  102. the traffic go out through eth1, but not lo nor eth0. This option is useful to
  103. control traffic in multi-interface environment.
  104. Not available in redir mode.
  105. .TP
  106. .B \-b \fIlocal_address\fP
  107. Specify local address to bind.
  108. Not available in server nor manager mode.
  109. .TP
  110. .B \-u
  111. Enable UDP relay.
  112. TPROXY is required in redir mode. You may need root permission.
  113. .TP
  114. .B \-U
  115. Enable UDP relay and disable TCP relay.
  116. Not available in local mode.
  117. .TP
  118. .B \-A
  119. Enable onetime authentication.
  120. .TP
  121. .B \-w
  122. Enable white list mode (when ACL enabled).
  123. Only available in server mode.
  124. .TP
  125. .B \-L \fIaddr\fR:\fIport\fP
  126. Specify destination server address and port for local port forwarding.
  127. Only available in tunnel mode.
  128. .TP
  129. .B \-d \fIaddr\fP
  130. Setup name servers for internal DNS resolver (libudns). The default server is
  131. fetched from /etc/resolv.conf.
  132. Only available in server and manager mode.
  133. .TP
  134. .B \--fast-open
  135. Enable TCP fast open.
  136. Not available in redir nor tunnel mode, with Linux kernel > 3.7.0.
  137. .TP
  138. .B \--acl \fIacl_config\fP
  139. Enable ACL (Access Control List) and specify config file.
  140. Not available in redir nor tunnel mode.
  141. .TP
  142. .B \--manager-address \fIpath_to_unix_domain\fP
  143. Specify UNIX domain socket address.
  144. Only available in server and manager mode.
  145. .TP
  146. .B \--executable \fIpath_to_server_executable\fP
  147. Specify the executable path of ss-server.
  148. Only available in manager mode.
  149. .TP
  150. .B \-v
  151. Enable verbose mode.
  152. .TP
  153. .B \-h, --help
  154. Print help message.
  155. .SH EXAMPLE
  156. \*(Re requires netfilter's NAT function. Here is an example:
  157. .nf
  158. # Create new chain
  159. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  160. root@Wrt:~# iptables -t mangle -N SHADOWSOCKS
  161. # Ignore your shadowsocks server's addresses
  162. # It's very IMPORTANT, just be careful.
  163. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  164. # Ignore LANs and any other addresses you'd like to bypass the proxy
  165. # See Wikipedia and RFC5735 for full list of reserved networks.
  166. # See ashi009/bestroutetb for a highly optimized CHN route list.
  167. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  168. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  169. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  170. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  171. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  172. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  173. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  174. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  175. # Anything else should be redirected to shadowsocks's local port
  176. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  177. # Add any UDP rules
  178. root@Wrt:~# ip rule add fwmark 0x01/0x01 table 100
  179. root@Wrt:~# ip route add local 0.0.0.0/0 dev lo table 100
  180. root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01
  181. # Apply the rules
  182. root@Wrt:~# iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
  183. root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  184. # Start the shadowsocks-redir
  185. root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  186. .fi
  187. .SH PROTOCOL
  188. \*(Ma(1) provides several APIs through UDP protocol:
  189. .in +4n
  190. Send UDP commands in the following format to the manager-address provided to
  191. \*(Ma(1).
  192. command: [JSON data]
  193. To add a port:
  194. add: {"server_port": 8001, "password":"7cd308cc059"}
  195. To remove a port:
  196. remove: {"server_port": 8001}
  197. To receive a pong:
  198. ping
  199. Then \*(Ma(1) will send back the traffic statistics:
  200. stat: {"8001":11370}
  201. .SH SEE ALSO
  202. .BR \*(Lo (1),
  203. .BR \*(Se (1),
  204. .BR \*(Tu (1),
  205. .BR \*(Re (1),
  206. .BR \*(Ma (1),
  207. .BR iptables (8),
  208. /etc/shadowsocks-libev/config.json
  209. .br
  210. .SH AUTHOR
  211. shadowsocks was created by clowwindy <clowwindy42@gmail.com> and
  212. shadowsocks-libev was maintained by Max Lv <max.c.lv@gmail.com> and Linus Yang
  213. <laokongzi@gmail.com>.
  214. .PP
  215. This manual page was written by Max Lv <max.c.lv@gmail.com>.
  216. .PP
  217. The manual pages were rearranged by hosiet <073plan@gmail.com>.