Repository navigation
EN Snishaper Core
dongle edited this page Oct 25, 2026
·
6 revisions
snishaper-core (Go module: github.com/SnishaperTeam/snishaper-core, AGPL-3.0) is the core proxy library extracted from SniShaper. The SniShaper app depends on it directly via go.mod; the core proxy code is no longer vendored in the app repo.
| Package | Description |
|---|---|
proxy |
ProxyServer (HTTP + SOCKS5 hybrid port), RuleManager (rule engine; since v0.7.0 rules live in an effective-state file plus a pristine upstream backup with the user diff derived on demand, exposing GetRulesLayerInfo / RevertSiteGroupToUpstream / RevertUpstreamConfigToUpstream), AutoRouter, MITM, upstream dialing |
subscription |
Clash subscription parsing, node storage and protocol outbound (vmess / vless / trojan / shadowsocks / hysteria / tuic / wireguard, etc., mihomo adapters; since v0.2.0) |
dohresolver |
Multi-node DoH failover resolution |
cfpool |
Cloudflare preferred-IP pool |
netiface |
Physical interface selection and outbound binding |
tlsfrag |
TLS ClientHello fragmentation (TLS-RF) |
gfwlist |
GFWList domain suffix matching (local cache file only, no network updates) |
certmanager |
CA generation, MITM certificate minting, system trust installation |
singtun |
sing-tun based TUN dataplane |
config |
Shared configuration types (CertVerifyConfig etc.) |
log |
Logger interface with Nop / Std / Func adapters |
-
Zero global mutable state: no
init(), no package-level mutable state, no environment reads, noos.Exit; safe for multiple instances and concurrent embedding. -
Injected behavior: logging goes through
log.Logger(defaults toNop; the SniShaper app injectsStd); the debug switch (formerlySNISHAPER_ROUTER_DEBUG=1) is injected viaproxy.WithRouterDebug. -
Product identity injected via
config.Brand:proxy,dohresolverandsubscriptionall accept brand options; the zero value falls back toconfig.DefaultProductName(SniShaper). The library hardcodes no product name — including the subscription download User-Agent (clash-verge/v2.0 <product>). Embedders other than SniShaper should pass their own name explicitly. - Config semantics compatibility: rule and settings JSON formats and semantics stay consistent with the SniShaper app side.
Release dependencies come from go.mod (currently v0.7.0). To modify both repos at once, add a temporary local replace to SniShaper's go.mod:
replace github.com/SnishaperTeam/snishaper-core => ../snishaper-core
Remove the replace before committing. Full library docs live in its repo README and docs/DESIGN.md; a minimal embedder sample is available at examples/basic.
- Home
- 完整使用指南
- CLI 命令参考
- 核心模式详解
- 智能分流详解
- 规则自定义指南
- 界面配置指南
- 证书重新安装
- macOS 菜单栏应用
- Linux 软件包
- 代码结构
- Snishaper-Core 核心库
- CI 与 PR 自动化
- 便携式自动更新器
- 常见问题与排障
- Home
- Usage Guide
- CLI Reference
- Core Proxy Modes
- Auto Routing
- Custom Rules Guide
- GUI Configuration
- Certificate Installation
- macOS Menu Bar App
- Linux Packages
- Code Structure
- Snishaper-Core Library
- CI & PR Automation
- Portable Auto-Updater
- FAQ