<commit_before># ssmanager
The python module interact with server-mode shadowsocks-libev.

> Shadowsocks-libev 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`.

This module works like `ss-manager` of
[shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev),
except it provide Python API instead of UNIX domain socket or UDP API.

It has own implementation rather than communicate with `ss-manager`, hence
the only dependence is `ss-server`.
<commit_msg>Add usage example<commit_after># ssmanager
The python module interact with server-mode
[shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev).

> Shadowsocks-libev 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`.

This module works like `ss-manager`,
except it provide Python API instead of UNIX domain socket or UDP API.

It has own implementation rather than communicate with `ss-manager`, hence
the only dependence is `ss-server`.

## Usage

Example:

```
from ssmanager import Manager, Server

manager = Manager(ss_bin='/usr/bin/ss-server')
manager.start()

server = Server(1234, 'password', '<PASSWORD>',
                udp=True, ota=True, fast_open=True)
manager.add(server)
manager.remove(server)  # Or manager.remove(1234)

servers = [Server(...), ...]
manager.update(servers)

manager.stat()
# Return a dict of { port_number: total_traffic_in_bytes }.

manager.stop()
```
{'fraction_non_alphanumeric': 0.10489949748743718, 'fraction_numerical': 0.00628140703517588, 'mean_word_length': 4.835164835164835, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3154194', 'n_tokens_mistral': 471, 'n_tokens_neox': 461, 'n_words': 166}