Skip to content

feat: support shadow-tls in sing-box subscription output#823

Open
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:feat/singbox-shadow-tls-subscription
Open

feat: support shadow-tls in sing-box subscription output#823
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:feat/singbox-shadow-tls-subscription

Conversation

@onesyue
Copy link
Copy Markdown

@onesyue onesyue commented Mar 20, 2026

Problem

When a Shadowsocks node has plugin: shadow-tls configured in protocol_settings, the sing-box subscription handler passes raw plugin / plugin_opts strings:

{
  "type": "shadowsocks",
  "plugin": "shadow-tls",
  "plugin_opts": "version=3;host=gateway.icloud.com;password=xxx"
}

sing-box does not support shadow-tls as a plugin field. This causes shadow-tls nodes to be completely broken for all sing-box-based clients (sing-box, Hiddify, SFM).

Note: Clash Meta (ClashMeta.php) already handles this correctly with a dedicated case 'shadow-tls' block.

Fix

Detect shadow-tls plugin and generate the proper sing-box outbound chain:

{
  "type": "shadowsocks",
  "tag": "NodeName",
  "detour": "NodeName-shadowtls",
  ...
}
{
  "type": "shadowtls",
  "tag": "NodeName-shadowtls",
  "server": "...",
  "server_port": 443,
  "version": 3,
  "password": "...",
  "tls": { "enabled": true, "server_name": "gateway.icloud.com" }
}

The -shadowtls helper outbounds are filtered from selector/urltest proxy groups so they don't appear as standalone nodes.

Other plugins (obfs, v2ray-plugin, etc.) continue to use the existing raw passthrough behavior.

Test

Verified with sing-box 1.13.x client — shadow-tls nodes now connect successfully via subscription.

sing-box does not support shadow-tls as a shadowsocks plugin field.
The current code passes raw `plugin` and `plugin_opts` strings which
sing-box cannot parse, breaking shadow-tls nodes for all sing-box
based clients (sing-box, Hiddify, SFM).

The correct sing-box configuration requires a separate `shadowtls`
outbound with the SS outbound referencing it via `detour`:

```json
{"type": "shadowsocks", "detour": "node-shadowtls", ...}
{"type": "shadowtls", "tag": "node-shadowtls", "version": 3, ...}
```

This commit:
- Detects `plugin: shadow-tls` in protocol_settings
- Generates a proper shadowtls outbound + detour chain
- Filters shadowtls helper tags from selector/urltest groups
- Falls through to raw plugin handling for other plugins (obfs etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant