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.

227 lines
7.1 KiB

11 years ago
11 years ago
11 years ago
10 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
10 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
10 years ago
10 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
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-2015, 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" "September 10, 2015" "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 local
  44. machines to proxy TCP traffic. \*(Tu(1) is a tool for local port forwarding.
  45. .PP
  46. While \*(Lo(1) works as a standard socks5 proxy, \*(Re(1) works as a transparent proxy
  47. and requires netfilter's NAT module. For more information, check out the example
  48. section.
  49. .PP
  50. \*(Ma(1) is a controller for multi-user management and traffic statistics, using UNIX
  51. domain socket to talk with \*(Se(1). Also, it provides a UNIX domain socket or IP based
  52. API for other software. About the details of this API, please refer to the protocol
  53. section.
  54. .SH OPTIONS
  55. .TP
  56. .B \-s \fIserver_host\fP
  57. Set the server's hostname or IP.
  58. .TP
  59. .B \-p \fIserver_port\fP
  60. Set the server's port number.
  61. .TP
  62. .B \-l \fIlocal_port\fP
  63. Set the local port number.
  64. .TP
  65. .B \-k \fIpassword\fP
  66. Set the password. The server and the client should use the same password.
  67. .TP
  68. .B \-m \fIencrypt_method\fP
  69. Set the cipher.
  70. \*(Me accepts 18 different ciphers: table, rc4, rc4-md5,
  71. aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, camellia-128-cfb,
  72. camellia-192-cfb, camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb, rc2-cfb,
  73. seed-cfb, salsa20, chacha20 and chacha20-ietf. The default cipher is \fItable\fP.
  74. If built with PolarSSL or custom OpenSSL libraries, some of these ciphers may
  75. not work.
  76. .TP
  77. .B \-f \fIpid_file\fP
  78. Start shadowsocks as a daemon with specific pid file.
  79. .TP
  80. .B \-t \fItimeout\fP
  81. Set the socket timeout in seconds. The default value is 10.
  82. .TP
  83. .B \-c \fIconfig_file\fP
  84. Use a configuration file.
  85. .TP
  86. .B \-n \fInofile\fP
  87. Specify max number of open files.
  88. Only available on Linux.
  89. .TP
  90. .B \-i \fIinterface\fP
  91. Specify network interface to bind.
  92. Not available in redir mode.
  93. .TP
  94. .B \-b \fIlocal_address\fP
  95. Specify local address to bind.
  96. Not available in server mode.
  97. .TP
  98. .B \-a \fIuser_name\fP
  99. Run as a specific user.
  100. .TP
  101. .B \-u
  102. Enable UDP relay.
  103. TPROXY is required in redir mode.
  104. .TP
  105. .B \-U
  106. Enable UDP relay and disable TCP relay.
  107. Not available in local mode.
  108. .TP
  109. .B \-A
  110. Enable onetime authentication.
  111. .TP
  112. .B \-L \fIaddr\fR:\fIport\fP
  113. Specify destination server address and port for local port forwarding.
  114. Only available in tunnel mode.
  115. .TP
  116. .B \-d \fIaddr\fP
  117. Setup name servers for internal DNS resolver (libudns). The default server
  118. is fetched from /etc/resolv.conf.
  119. Only available in server mode.
  120. .TP
  121. .B \--fast-open
  122. Enable TCP fast open.
  123. Only available in local and server mode, with Linux kernel > 3.7.0.
  124. .TP
  125. .B \--acl \fIacl_config\fP
  126. Enable ACL (Access Control List) and specify config file.
  127. Only available in local and server mode.
  128. .TP
  129. .B \--manager-address \fIpath_to_unix_domain\fP
  130. Specify UNIX domain socket address.
  131. Only available in server and manager mode.
  132. .TP
  133. .B \--executable \fIpath_to_server_executable\fP
  134. Specify the executable path of ss-server.
  135. Only available in manager mode.
  136. .TP
  137. .B \-v
  138. Enable verbose mode.
  139. .SH EXAMPLE
  140. \*(Re requires netfilter's NAT function. Here is an example:
  141. # Create new chain
  142. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  143. # Ignore your shadowsocks server's addresses
  144. # It's very IMPORTANT, just be careful.
  145. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  146. # Ignore LANs and any other addresses you'd like to bypass the proxy
  147. # See Wikipedia and RFC5735 for full list of reserved networks.
  148. # See ashi009/bestroutetb for a highly optimized CHN route list.
  149. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  150. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  151. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  152. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  153. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  154. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  155. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  156. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  157. # Anything else should be redirected to shadowsocks's local port
  158. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  159. # Add any UDP rules
  160. root@Wrt:~# ip rule add fwmark 0x01/0x01 table 100
  161. root@Wrt:~# ip route add local 0.0.0.0/0 dev lo table 100
  162. root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01
  163. # Apply the rules
  164. root@Wrt:~# iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
  165. root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  166. # Start the shadowsocks-redir
  167. root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  168. .SH PROTOCOL
  169. \*(Ma(1) provides several APIs through UDP protocol:
  170. Send UDP commands in the following format to the manager-address provided to \*(Ma(1).
  171. command: [JSON data]
  172. To add a port:
  173. add: {"server_port": 8001, "password":"7cd308cc059"}
  174. To remove a port:
  175. remove: {"server_port": 8001}
  176. To receive a pong:
  177. ping
  178. Then \*(Ma(1) will send back the traffic statistics:
  179. stat: {"8001":11370}
  180. .SH SEE ALSO
  181. .BR \*(Lo (1),
  182. .BR \*(Se (1),
  183. .BR \*(Tu (1),
  184. .BR \*(Re (1),
  185. .BR \*(Ma (1),
  186. .BR iptables (8),
  187. /etc/shadowsocks-libev/config.json
  188. .br
  189. .SH AUTHOR
  190. shadowsocks was created by clowwindy <clowwindy42@gmail.com> and
  191. shadowsocks-libev was maintained by Max Lv <max.c.lv@gmail.com> and Linus Yang
  192. <laokongzi@gmail.com>.
  193. .PP
  194. This manual page was written by Max Lv <max.c.lv@gmail.com>.
  195. .PP
  196. The manual pages were rearranged by hosiet <073plan@gmail.com>.