Merge pull request #1 from shadowsocks/master

test
This commit is contained in:
MRunFoss 2015-01-09 12:49:21 +08:00
commit 0dc33bf977
6 changed files with 56 additions and 125 deletions

View file

@ -1,38 +1,27 @@
How to contribute How to Contribute
================= =================
在你提交问题前,请先[自行诊断]一下。提交时附上诊断过程中的问题和下列结果, Pull Requests
否则如果我们无法重现你的问题,也就不能帮助你。 -------------
Before you submit issues, please read [Troubleshooting] and take a few minutes 1. Pull requests are welcome. If you would like to add a large feature
to read this guide. or make a significant change, make sure to open an issue to discuss with
people first.
问题反馈 2. Follow PEP8.
------- 3. Make sure to pass the unit tests. Write unit tests for new modules if
needed.
请提交下面的信息:
1. 你是如何搭建环境的操作系统Shadowsocks 版本)
2. 操作步骤是什么?
3. 浏览器里的现象是什么?一直转菊花,还是有提示错误?
4. 发生错误时,客户端和服务端最后一部分日志。
5. 其它你认为可能和问题有关的信息。
如果你不清楚其中某条的含义, 可以直接跳过那一条。
Issues Issues
------ ------
Please include the following information in your submission: 1. Only bugs and feature requests are accepted here.
2. We'll only work on important features. If the feature you're asking only
benefits a few people, you'd better implement the feature yourself and send us
a pull request, or ask some of your friends to do so.
3. We don't answer questions of any other types here. Since very few people
are watching the issue tracker here, you'll probably get no help from here.
Read [Troubleshooting] and get help from forums or [mailing lists].
1. How did you set up your environment? (OS, version of Shadowsocks)
2. Steps to reproduce the problem.
3. What happened in your browser? Just no response, or any error message?
4. 10 lines of log on the local side of shadowsocks when the error happened.
5. 10 lines of log on the server side of shadowsocks when the error happened.
6. Any other useful information.
Skip any of them if you don't know its meaning.
[Troubleshooting]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting [Troubleshooting]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting
[自行诊断]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting [mailing lists]: https://groups.google.com/forum/#!forum/shadowsocks

View file

@ -7,8 +7,6 @@ shadowsocks
A fast tunnel proxy that helps you bypass firewalls. A fast tunnel proxy that helps you bypass firewalls.
[中文说明][Chinese Readme]
Server Server
------ ------
@ -67,9 +65,9 @@ Bugs and Issues
* [Mailing list] * [Mailing list]
[Android]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#android [Android]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#android
[Build Status]: https://img.shields.io/travis/shadowsocks/shadowsocks/master.svg?style=flat [Build Status]: https://img.shields.io/travis/shadowsocks/shadowsocks/master.svg?style=flat
[Chinese Readme]: https://github.com/shadowsocks/shadowsocks/wiki/Shadowsocks-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
[Configuration]: https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File [Configuration]: https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File
[Coverage Status]: https://jenkins.shadowvpn.org/result/shadowsocks [Coverage Status]: https://jenkins.shadowvpn.org/result/shadowsocks
[Coverage]: https://jenkins.shadowvpn.org/job/Shadowsocks/ws/htmlcov/index.html [Coverage]: https://jenkins.shadowvpn.org/job/Shadowsocks/ws/htmlcov/index.html

View file

@ -5,26 +5,11 @@ shadowsocks
A fast tunnel proxy that helps you bypass firewalls. A fast tunnel proxy that helps you bypass firewalls.
`中文说明 <https://github.com/shadowsocks/shadowsocks/wiki/Shadowsocks-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E>`__ Server
------
Install Install
------- ~~~~~~~
You'll have a client on your local side, and setup a server on a remote
server.
Client
~~~~~~
- `Windows <https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#windows>`__
/ `OS
X <https://github.com/shadowsocks/shadowsocks-iOS/wiki/Shadowsocks-for-OSX-Help>`__
- `Android <https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#android>`__
/ `iOS <https://github.com/shadowsocks/shadowsocks-iOS/wiki/Help>`__
- `OpenWRT <https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#openwrt>`__
Server
~~~~~~
Debian / Ubuntu: Debian / Ubuntu:
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
@ -34,107 +19,56 @@ Debian / Ubuntu:
apt-get install python-pip apt-get install python-pip
pip install shadowsocks pip install shadowsocks
Or simply ``apt-get install shadowsocks`` if you have `Debian
sid <https://packages.debian.org/unstable/python/shadowsocks>`__ in your
source list.
CentOS: CentOS:
^^^^^^^ ^^^^^^^
:: ::
yum install python-setuptools yum install python-setuptools && easy_install pip
easy_install pip
pip install shadowsocks pip install shadowsocks
Windows: Windows:
^^^^^^^^ ^^^^^^^^
Download `OpenSSL for See `Install Server on
Windows <http://slproweb.com/products/Win32OpenSSL.html>`__ and install. Windows <https://github.com/shadowsocks/shadowsocks/wiki/Install-Shadowsocks-Server-on-Windows>`__
Then install shadowsocks via easy\_install and pip as Linux. If you
don't know how to use them, you can directly download `the
package <https://pypi.python.org/pypi/shadowsocks>`__, and use
``python shadowsocks/server.py`` instead of ``ssserver`` command below.
Configuration Usage
------------- ~~~~~
On your server create a config file ``/etc/shadowsocks.json``. Example:
:: ::
{ ssserver -p 8000 -k password -m rc4-md5
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
Explanation of the fields:
+------------------+-----------------------------------------------------------------------------------------------------------+
| Name | Explanation |
+==================+===========================================================================================================+
| server | the address your server listens |
+------------------+-----------------------------------------------------------------------------------------------------------+
| server\_port | server port |
+------------------+-----------------------------------------------------------------------------------------------------------+
| local\_address | the address your local listens |
+------------------+-----------------------------------------------------------------------------------------------------------+
| local\_port | local port |
+------------------+-----------------------------------------------------------------------------------------------------------+
| password | password used for encryption |
+------------------+-----------------------------------------------------------------------------------------------------------+
| timeout | in seconds |
+------------------+-----------------------------------------------------------------------------------------------------------+
| method | default: "aes-256-cfb", see `Encryption <https://github.com/shadowsocks/shadowsocks/wiki/Encryption>`__ |
+------------------+-----------------------------------------------------------------------------------------------------------+
| fast\_open | use `TCP\_FASTOPEN <https://github.com/shadowsocks/shadowsocks/wiki/TCP-Fast-Open>`__, true / false |
+------------------+-----------------------------------------------------------------------------------------------------------+
| workers | number of workers, available on Unix/Linux |
+------------------+-----------------------------------------------------------------------------------------------------------+
On your server:
To run in the foreground:
::
ssserver -c /etc/shadowsocks.json
To run in the background: To run in the background:
:: ::
ssserver -c /etc/shadowsocks.json -d start ssserver -p 8000 -k password -m rc4-md5 -d start
ssserver -c /etc/shadowsocks.json -d stop ssserver -p 8000 -k password -m rc4-md5 -d stop
On your client machine, use the same configuration as your server. Check Check all the options via ``-h``. You can also use a
the README of your client for more information. `Configuration <https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File>`__
file instead.
Command Line Options Client
-------------------- ------
Check the options via ``-h``.You can use args to override settings from - `Windows <https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#windows>`__
``config.json``. / `OS
X <https://github.com/shadowsocks/shadowsocks-iOS/wiki/Shadowsocks-for-OSX-Help>`__
- `Android <https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#android>`__
/ `iOS <https://github.com/shadowsocks/shadowsocks-iOS/wiki/Help>`__
- `OpenWRT <https://github.com/shadowsocks/openwrt-shadowsocks>`__
:: Use GUI clients on your local PC/phones. Check the README of your client
for more information.
sslocal -s server_name -p server_port -l local_port -k password -m bf-cfb
ssserver -p server_port -k password -m bf-cfb --workers 2
ssserver -c /etc/shadowsocks/config.json -d start --pid-file=/tmp/shadowsocks.pid
ssserver -c /etc/shadowsocks/config.json -d stop --pid-file=/tmp/shadowsocks.pid
Documentation Documentation
------------- -------------
You can find all the documentation in the wiki: You can find all the documentation in the
https://github.com/shadowsocks/shadowsocks/wiki `Wiki <https://github.com/shadowsocks/shadowsocks/wiki>`__.
License License
------- -------
@ -147,7 +81,7 @@ Bugs and Issues
- `Troubleshooting <https://github.com/shadowsocks/shadowsocks/wiki/Troubleshooting>`__ - `Troubleshooting <https://github.com/shadowsocks/shadowsocks/wiki/Troubleshooting>`__
- `Issue - `Issue
Tracker <https://github.com/shadowsocks/shadowsocks/issues?state=open>`__ Tracker <https://github.com/shadowsocks/shadowsocks/issues?state=open>`__
- `Mailing list <http://groups.google.com/group/shadowsocks>`__ - `Mailing list <https://groups.google.com/group/shadowsocks>`__
.. |PyPI version| image:: https://img.shields.io/pypi/v/shadowsocks.svg?style=flat .. |PyPI version| image:: https://img.shields.io/pypi/v/shadowsocks.svg?style=flat
:target: https://pypi.python.org/pypi/shadowsocks :target: https://pypi.python.org/pypi/shadowsocks

View file

@ -42,11 +42,16 @@ def load_libsodium():
global loaded, libsodium, buf global loaded, libsodium, buf
from ctypes.util import find_library from ctypes.util import find_library
libsodium_path = None
for p in ('sodium', 'libsodium'): for p in ('sodium', 'libsodium'):
libsodium_path = find_library(p) libsodium_path = find_library(p)
if libsodium_path: if libsodium_path:
break break
else: else:
import glob
for libsodium_path in glob.glob('/usr/lib/libsodium.*'):
pass
if libsodium_path is None:
raise Exception('libsodium not found') raise Exception('libsodium not found')
logging.info('loading libsodium from %s', libsodium_path) logging.info('loading libsodium from %s', libsodium_path)
libsodium = CDLL(libsodium_path) libsodium = CDLL(libsodium_path)

View file

@ -39,11 +39,16 @@ def load_openssl():
global loaded, libcrypto, buf global loaded, libcrypto, buf
from ctypes.util import find_library from ctypes.util import find_library
libcrypto_path = None
for p in ('crypto', 'eay32', 'libeay32'): for p in ('crypto', 'eay32', 'libeay32'):
libcrypto_path = find_library(p) libcrypto_path = find_library(p)
if libcrypto_path: if libcrypto_path:
break break
else: else:
import glob
for libcrypto_path in glob.glob('/usr/lib/libcrypto.*'):
pass
if libcrypto_path is None:
raise Exception('libcrypto(OpenSSL) not found') raise Exception('libcrypto(OpenSSL) not found')
logging.info('loading libcrypto from %s', libcrypto_path) logging.info('loading libcrypto from %s', libcrypto_path)
libcrypto = CDLL(libcrypto_path) libcrypto = CDLL(libcrypto_path)

View file

@ -172,7 +172,7 @@ def get_config(is_local):
sys.exit(2) sys.exit(2)
config['password'] = config.get('password', '') config['password'] = config.get('password', '')
config['method'] = config.get('method', 'aes-256-cfb') config['method'] = config.get('method', b'aes-256-cfb')
config['port_password'] = config.get('port_password', None) config['port_password'] = config.get('port_password', None)
config['timeout'] = int(config.get('timeout', 300)) config['timeout'] = int(config.get('timeout', 300))
config['fast_open'] = config.get('fast_open', False) config['fast_open'] = config.get('fast_open', False)