{"id":13775921,"url":"https://github.com/sorz/ssmanager","last_synced_at":"2025-04-10T05:24:46.091Z","repository":{"id":145451816,"uuid":"57889045","full_name":"sorz/ssmanager","owner":"sorz","description":"A python module managing large amount of running Shadowsocks server instances.","archived":false,"fork":false,"pushed_at":"2017-12-21T22:16:41.000Z","size":68,"stargazers_count":22,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T18:55:22.229Z","etag":null,"topics":["python","shadowsocks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sorz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-02T12:35:00.000Z","updated_at":"2022-12-21T09:46:18.000Z","dependencies_parsed_at":"2024-01-07T22:47:44.024Z","dependency_job_id":"285b577f-c427-4c2b-bd09-bdb79601783b","html_url":"https://github.com/sorz/ssmanager","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorz%2Fssmanager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorz%2Fssmanager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorz%2Fssmanager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorz%2Fssmanager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sorz","download_url":"https://codeload.github.com/sorz/ssmanager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161860,"owners_count":21057660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","shadowsocks"],"created_at":"2024-08-03T17:01:54.526Z","updated_at":"2025-04-10T05:24:46.050Z","avatar_url":"https://github.com/sorz.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具","Python"],"sub_categories":["\u003ca id=\"cb16466a31a167bb61f39e2a4a85f449\"\u003e\u003c/a\u003eShadowsocks"],"readme":"# ssmanager\nA python module interact with manager-mode\n[shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)\nor [shadowsocks-python](https://github.com/shadowsocks/shadowsocks) server.\n\n\u003e Shadowsocks-libev consists of five components. ss-manager(1) is a controller\n\u003e for multi-user management and traffic statistics, using UNIX domain socket\n\u003e to talk with `ss-server`.\n\nThis module works like `ss-manager`,\nexcept it provide Python API instead of UNIX domain socket or UDP API.\n\nIt has own implementation rather than communicate with `ss-manager`, hence\nthe only dependence is `ss-server`.\n\nSince version 0.2.0, it plays happily with not only ss-libev but also the\nPython port.\n\n## Install\n\n```\n$ pip install git+https://github.com/sorz/ssmanager.git\n```\n\n## Usage\n\nExample:\n\n```python\nfrom ssmanager import Server\nfrom ssmanager.sslibev import Manager\n# For Python port, use:\n# from ssmanager.sspy import Manager\n\nmanager = Manager(ss_bin='/usr/bin/ss-server')\n# Point to ssserver if using Python port.\nmanager.start()\n\nserver = Server(1234, 'password', 'aes-256-cfb',\n                udp=True, fast_open=True)\nmanager.add(server)\nmanager.remove(server)  # Or manager.remove(1234)\n\nservers = [Server(...), ...]\nmanager.update(servers)\n\nmanager.stat()\n# Return a dict of { port_number: total_traffic_in_bytes }.\n\nmanager.stop()\n```\n\nIt's easy to build multiple-user/port Shadowsocks servers with a centrally\nserver who distributes user configurations using ssmanager. A simple example\nis following.\n\nUpload a JSON file to, for example, http://example.com/ss-profiles.json.\nThe JSON contains all profiles of Shadowsocks users:\n\n```javascript\n[{\"port\": 8001, \"password\": \"test123\", \"method\": \"chacha20\"},\n {\"port\": 8002, \"password\": \"123test\", \"method\": \"aes-256-cfb\"}]\n```\n\nFollowing script grab this JSON every 2 minutes and update its configs if\ncontent of the JSON changed. (Exception handling is omited.)\n\n```python\nimport time, requests\nfrom ssmanager import Server\nfrom ssmanager.sspy import Manager\n\nmanager = Manager()\nmanager.start()\n\nwhile True:\n    profiles = requests.get('http://example.com/ss-profiles.json').json()\n    manager.update([Server(**p) for p in profiles])\n    time.sleep(120)\n```\n\n## Related projects\n- [ssmanager-nopanel](https://github.com/fzinfz/ssmanager-nopanel):\n  ssmanager web daemon, supports multi methods \u0026 influxdb.\n- [yassp-server](https://github.com/sorz/yassp-server):\n   manage Shadowsocks server instances via HTTP APIs.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorz%2Fssmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsorz%2Fssmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorz%2Fssmanager/lists"}