Norain
基于 sing-box 的 Hysteria2 / Trojan 代理:客户端 norain 和服务端 norain-server,Python 做控制层,
sing-box 做数据面,兼容 Windows 和 Linux。
安装
pip install norain
同一个包提供两个命令:norain(客户端)和 norain-server(服务端)。
当前状态:0.2.0 首个正式版。两端模块代码齐备;测试套件在 Windows 上 95 项通过(3 项仅 POSIX 跳过)。
已在真实环境验证过的部分:生成配置通过真实 sing-box 1.14.4 check、本地端到端隧道、TUN 路由接管与还原、
Windows 防火墙阻断与解除、nftables 阻断、系统代理写入与还原、服务端 install/reload/fix/update/uninstall、
systemd 开机自启(真实重启)、真实 ACME 签发。仍未验证:客户端与 Linux 的安装流程、TUN 的实际流量、
监控错误码、自维持互拉、分流学习闭环。逐项见 docs/pending.md。
优先级:以最初目标 docs/reference/original-goals.md 为准,除非有硬性 bug。
客户端(九个模块)
代理、分流、监控、自维持、阻断、修复、启动、内控制、外控制。
norain install --server example.com # 部署:sing-box、配置、norain 命令、环境变量、开机自启动
norain start | stop | restart | status
norain config protocol auto # 自适应 / hysteria2 / trojan
norain config mode safe # 安全模式:不开机自启动
norain list white add example.com # 白名单 / black 黑名单 / blue 蓝名单 / monitor 监控名单
norain module monitor restart # 启动 / 结束 / 重启单个模块
norain repair file|builtin|full|reload # 四种修复
norain block status|off # 阻断模式;off = 手动解除
norain once monitor # 一次性执行某个模块的某个功能
norain status -t # -t:显示每个模块的运行情况和返回结果
norain uninstall
服务端
干净机器上可以直接用引导脚本(系统依赖 → 虚拟环境 → 安装包 → norain-server install):
sudo ./scripts/bootstrap-server.sh
已经装好 Python 与 venv 时,照常手动安装:
NORAIN_DOMAIN=example.com NORAIN_PASSWORD=… norain-server install
norain-server start | stop | restart | reload | status
norain-server config validate|show|edit
norain-server cert check | cert self-signed --domain <域名>
norain-server firewall open|close|status
norain-server fix
norain-server update | uninstall [--purge]
文档
- 交接说明和未验证项目:HANDOFF.md
- 实现状态清单:docs/pending.md
- 决策记录:docs/decisions/
- 配置示例:examples/server.toml、examples/cfg.toml
- sing-box 锁定版本:third_party/singbox.lock.toml(1.14.4)
开发
需要 Python ≥ 3.11,以及 pydantic、cryptography、psutil。
pip install -e ".[dev]"
python3 -m pytest -q
Metadata
Release files for norain 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| norain-0.2.0.tar.gz | 157.5 kB | With provenance | Details for norain-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| norain-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for norain-0.2.0-py3-none-any.whl |
Total release size: 318.7 kB
Release files / norain-0.2.0.tar.gz
| Download URL | norain-0.2.0.tar.gz |
|---|---|
| Size | 157.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31526a0389d055ad2fb7b708a5aa5158dbddb52615694c4b47f2a9fc5a432f18
|
|
BLAKE2b-256 checksum How to use checksums |
b2520cd49a2b74390947098a9252bd2d5ff7ffaae31dd2f03155e818c2f9079b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / norain-0.2.0-py3-none-any.whl
| Download URL | norain-0.2.0-py3-none-any.whl |
|---|---|
| Size | 161.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9aa8a601c5850958807dbe0a149d05e8c70b2d84d1d13e5b6bef08eea4811c6
|
|
BLAKE2b-256 checksum How to use checksums |
4f162715d29de12eae4eb77d472394bf97cd4f38830f8bc4293a3d30d58523c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for norain 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for norain-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.