Files
shadowsocks-libev/doc/ss-manager.md
T
Max Lv d6691b9e33 C++20 port 4/14: compile the event loop, UDP relay and programs as C++ (#3068)
* Make the event loop, UDP relay and programs compile as C++

Cast allocator results and void* callback data explicitly, cast string
literals stored in char * variables, replace compound literals in
ss_event.c with zeroing plus member assignment, and give ss-server's
listener array its MAX_REMOTE_NUM bound instead of a VLA.

Where a goto CLEAN_UP jumps over an initialised declaration (C++
rejects that), split the declaration from its initialisation in place.
The variables were already indeterminate at the label in C, and the
cleanup code does not read them. Checked for every MODULE_* variant of
udprelay.c, plus LIB_ONLY for local.c. Still valid C.

* Compile the event loop, UDP relay and programs as C++

Rename utils, ss_event, udprelay, winsock, local, server, tunnel, redir
and manager from .c to .cpp. Inside the moved files only the
\snippet{doc} file references and header comments change; snippet
references in doc/*.md, tests/test_cli_docs.py, the build files and
CONTRIBUTION.md follow the new names.

Also cast the Windows-only string literal returned by
get_default_conf(), found by the zig x86_64-windows-gnu build.

Every module of src/ except the unbuilt android.c and the vendored
blake3 is now compiled as C++20. The new .cpp files join the no-heap
ratchet baseline.

* Add the two casts ss-redir needs as C++

ss-redir only builds on Linux, so the macOS conversion checks never
compiled it: getsockname() wants a struct sockaddr *, and memcpy's
void * result needs a cast.
2026-10-15 09:53:31 +08:00

2.4 KiB

\page ss-manager ss-manager

\brief ss-server controller for multi-user management and traffic statistics

\section ss_manager_synopsis SYNOPSIS

ss-manager [options]

\section ss_manager_description DESCRIPTION

shadowsocks-c is a lightweight and secure socks5 proxy. It is a port of the original shadowsocks created by clowwindy. shadowsocks-c is written in pure C and takes advantage of libuv to achieve both high performance and low resource consumption.

shadowsocks-c consists of five components. ss-manager(1) is a controller for multi-user management and traffic statistics, using UNIX domain socket to talk with ss-server(1). Also, it provides a UNIX domain socket or IP based API for other software. About the details of this API, please refer to the following PROTOCOL section.

\section ss_manager_options OPTIONS

Options include all supported platform variants; restrictions are noted below.

\snippet{doc} manager.cpp cli-options

\section ss_manager_protocol PROTOCOL

ss-manager(1) provides several APIs through UDP protocol:

Send UDP commands in the following format to the manager-address provided to ss-manager(1):

command: [JSON data]

To add a port:

add: {"server_port": 8001, "password":"7cd308cc059"}

To remove a port:

remove: {"server_port": 8001}

To receive the traffic statistics:

ping

The format of the traffic statistics:

stat: {"8001":11370}

There is no way to reset the traffic statistics, unless you remove the port and add it again

\section ss_manager_example EXAMPLE

To use ss-manager(1), First start it and specify necessary information.

Then communicate with ss-manager(1) through UNIX Domain Socket using UDP protocol:

# Start the manager. Arguments for ss-server will be passed to generated
# ss-server process(es) respectively.
ss-manager --manager-address /tmp/manager.sock --executable $(which ss-server) -s example.com -m aes-256-cfb -c /path/to/config.json

# Connect to the socket. Using netcat-openbsd as an example.
# You should use scripts or other programs for further management.
nc -Uu /tmp/manager.sock

After that, you may communicate with ss-manager(1) as described above in the PROTOCOL section.

\section ss_manager_see_also SEE ALSO

ss-local(1), ss-server(1), ss-tunnel(1), ss-redir(1), shadowsocks-libev(8), iptables(8), /etc/shadowsocks-libev/config.json