From 7330b853849790eb059207a773ac5be36538b9fd Mon Sep 17 00:00:00 2001 From: clowwindy Date: Thu, 6 Aug 2015 00:18:57 +0800 Subject: [PATCH] Created Manage Multiple Ports (markdown) --- Manage-Multiple-Ports.md | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Manage-Multiple-Ports.md diff --git a/Manage-Multiple-Ports.md b/Manage-Multiple-Ports.md new file mode 100644 index 0000000..44ca70c --- /dev/null +++ b/Manage-Multiple-Ports.md @@ -0,0 +1,48 @@ +If you want to develop a user management system, Shadowsocks provides an API that allows you to add/remove ports on the fly, as well as get transfer statistics from Shadowsocks. + +Note: this feature is currently in progress on `manager` branch and not released yet. + +Setup +----- + +Turn manager on by specifying `--manager-address`, which is either a Unix socket or an IP address: +``` +python shadowsocks/server.py --manager-address /var/run/shadowsocks-manager.sock -c tests/server-multi-passwd.json +# or +python shadowsocks/server.py --manager-address 127.0.0.1:6001 -c tests/server-multi-passwd.json +``` + +For security reasons, you should use Unix sockets. + +Protocol +-------- + +You can send UDP data to Shadowsocks. + +``` +command[: JSON data] +``` + +To add a port: + +``` +add: {"server_port": 8001, "password":"7cd308cc059"} +``` + +To remove a port: + +``` +remove: {"server_port": 8001} +``` + +To receive a pong: + +``` +ping +``` + +Shadowsocks will send back transfer statistics: + +``` +stat: {"8001":11370} +``` \ No newline at end of file