Wener Notes

sing-box

约 1 分钟阅读
  • SagerNet/sing-boxGitHubSagerNet/sing-boxSagerNet/sing-box · GPLv3, Golang · universal proxy platform · 支持协议 · ShadowTLS / Shadowsocks / Trojan / VLESS / VLESS-REALITY / VMess-HTTPUpgrade-TLS / VMess-WebSocket-TLS / VM...笔记:sing-box
    • GPLv3, Golang
    • universal proxy platform
    • 支持协议
      • ShadowTLS / Shadowsocks / Trojan / VLESS / VLESS-REALITY / VMess-HTTPUpgrade-TLS / VMess-WebSocket-TLS / VMess-WebSocket / VMess
  • 参考
    • GSO - Generic Segmentation Offload - 通用分段卸载
abbr.stand for
SFMsing-box for MacOS
SFAsing-box for Android
bash
# macOS Homebrew
brew install sing-box # 命令行 /opt/homebrew/etc/sing-box/config.json
brew install sfm      # 桌面应用

/opt/homebrew/opt/sing-box/bin/sing-box version

# AlpineLinux
# /usr/bin/sing-box
# sing-box -D /var/lib/sing-box -C /etc/sing-box check
# sing-box -D /var/lib/sing-box -C /etc/sing-box run
apk add -X https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing/ --no-cache sing-box
kill -HUP $(pgrep sing-box) # reload

# https://github.com/SagerNet/sing-box/releases
# https://sing-box.sagernet.org/changelog/
VERSION=1.14.2
curl -L -o sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/v${VERSION}/sing-box-${VERSION}-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/').tar.gz
# gtar -zxvf sing-box.tar.gz --strip-components=1 --wildcards '*/sing-box'
tar zxvf sing-box.tar.gz --strip-components=1 --wildcards '*/sing-box'
./sing-box version

# Linux
sudo mv sing-box /usr/local/bin/
# sudo mv sing-box /usr/bin/ # 配合 sing-box-openrc
apk add -X https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing/ --no-cache sing-box

docker run -d \
  -v /etc/sing-box:/etc/sing-box/ \
  --name=sing-box \
  --restart=always \
  ghcr.io/sagernet/sing-box \
  -D /var/lib/sing-box \
  -C /etc/sing-box/ run

sing-box version
sing-box check -c conf.json
sing-box run conf.json
flagfor
-c config.json
-C config.d
-D CWD
abbr.stand formeaning
VAPID
ECHEncrypted Client Hello加密客户端 Hello
RDRC
  • srs
    • 二进制的 rule set, zlib 压缩
  • Router
    • router
      • router.rules
    • dns
      • dns.rules
    • DnsClient
    • func RouteConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext)
      • .matchRule
        • 按需查找 ProcessInfo
        • 按需 匹配 FakeIP, 匹配到了更新 FQDN
        • 按需 DnsReverseMapping - IP -> Domain
        • 遍历 .rules.Match(metadata)
        • .actionSniff
      • action=route
      • action=reject
      • action=hijack-dns
  • NetworkManager
    • 监测 网络状态
    • 监测 网络接口
    • 监测 电源
  • InboundManager
  • OutboundManager
  • EndpointManager
  • ConnectionManager
  • platform.Interface
TypeScript
/*
	DomainStrategyAsIS DomainStrategy = iota
	DomainStrategyPreferIPv4
	DomainStrategyPreferIPv6
	DomainStrategyUseIPv4
	DomainStrategyUseIPv6
*/
// `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
type DomainStrategy = 'prefer_ipv4';

关联信息

反向链接、本文链接的其他页面和外部资料。

反向链接

  • Proxy Awesome
    笔记 · SagerNet/sing-box

    Note · 建议基于 overlay 组件内部 proxy,更安全,更好跨网。 · 对外暴露甚至选择 · | protocol | transport | UDP | Note | · | socks4 | tcp | ❌ | · | socks5 | tcp | ✅ |

References

GitHub3 条
最近更新commit e2ef364Edit

On this page