Created Manage Multiple Ports (markdown)
parent
bada95c907
commit
7330b85384
1 changed files with 48 additions and 0 deletions
48
Manage-Multiple-Ports.md
Normal file
48
Manage-Multiple-Ports.md
Normal file
|
@ -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}
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue