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.

222 lines
7.0 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. Shadowsocks accepts 16 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 and chacha20. 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 \-i \fIinterface\fP
  87. Specify network interface to bind.
  88. Not available in redir mode.
  89. .TP
  90. .B \-b \fIlocal_address\fP
  91. Specify local address to bind.
  92. Not available in server mode.
  93. .TP
  94. .B \-a \fIuser_name\fP
  95. Run as a specific user.
  96. .TP
  97. .B \-u
  98. Enable UDP relay.
  99. TPROXY is required in redir mode.
  100. .TP
  101. .B \-U
  102. Enable UDP relay and disable TCP relay.
  103. Not available in local mode.
  104. .TP
  105. .B \-A
  106. Enable onetime authentication.
  107. .TP
  108. .B \-L \fIaddr\fR:\fIport\fP
  109. Specify destination server address and port for local port forwarding.
  110. Only available in tunnel mode.
  111. .TP
  112. .B \-d \fIaddr\fP
  113. Setup name servers for internal DNS resolver (libudns). The default server
  114. is fetched from /etc/resolv.conf.
  115. Only available in server mode.
  116. .TP
  117. .B \--fast-open
  118. Enable TCP fast open.
  119. Only available in local and server mode, with Linux kernel > 3.7.0.
  120. .TP
  121. .B \--acl \fIacl_config\fP
  122. Enable ACL (Access Control List) and specify config file.
  123. Only available in local and server mode.
  124. .TP
  125. .B \--manager-address \fIpath_to_unix_domain\fP
  126. Specify UNIX domain socket address.
  127. Only available in server and manager mode.
  128. .TP
  129. .B \--executable \fIpath_to_server_executable\fP
  130. Specify the executable path of ss-server.
  131. Only available in manager mode.
  132. .TP
  133. .B \-v
  134. Enable verbose mode.
  135. .SH EXAMPLE
  136. \*(Re requires netfilter's NAT function. Here is an example:
  137. # Create new chain
  138. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  139. # Ignore your shadowsocks server's addresses
  140. # It's very IMPORTANT, just be careful.
  141. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  142. # Ignore LANs and any other addresses you'd like to bypass the proxy
  143. # See Wikipedia and RFC5735 for full list of reserved networks.
  144. # See ashi009/bestroutetb for a highly optimized CHN route list.
  145. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  146. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  147. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  148. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  149. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  150. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  151. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  152. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  153. # Anything else should be redirected to shadowsocks's local port
  154. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  155. # Add any UDP rules
  156. root@Wrt:~# ip rule add fwmark 0x01/0x01 table 100
  157. root@Wrt:~# ip route add local 0.0.0.0/0 dev lo table 100
  158. root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01
  159. # Apply the rules
  160. root@Wrt:~# iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
  161. root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  162. # Start the shadowsocks-redir
  163. root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  164. .SH PROTOCOL
  165. \*(Ma(1) provides several APIs through UDP protocol:
  166. Send UDP commands in the following format to the manager-address provided to \*(Ma(1).
  167. command: [JSON data]
  168. To add a port:
  169. add: {"server_port": 8001, "password":"7cd308cc059"}
  170. To remove a port:
  171. remove: {"server_port": 8001}
  172. To receive a pong:
  173. ping
  174. Then \*(Ma(1) will send back the traffic statistics:
  175. stat: {"8001":11370}
  176. .SH SEE ALSO
  177. .BR \*(Lo (1),
  178. .BR \*(Se (1),
  179. .BR \*(Tu (1),
  180. .BR \*(Re (1),
  181. .BR \*(Ma (1),
  182. .BR iptables (8),
  183. /etc/shadowsocks-libev/config.json
  184. .br
  185. .SH AUTHOR
  186. shadowsocks was created by clowwindy <clowwindy42@gmail.com> and
  187. shadowsocks-libev was maintained by Max Lv <max.c.lv@gmail.com> and Linus Yang
  188. <laokongzi@gmail.com>.
  189. .PP
  190. This manual page was written by Max Lv <max.c.lv@gmail.com>.
  191. .PP
  192. The manual pages were rearranged by hosiet <073plan@gmail.com>.