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