Skip to content

fix: protocol bugs in Loon, Stash, and Clash#818

Open
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/protocol-bugs
Open

fix: protocol bugs in Loon, Stash, and Clash#818
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/protocol-bugs

Conversation

@onesyue
Copy link
Copy Markdown

@onesyue onesyue commented Mar 19, 2026

Summary

  • Loon.php: Fix Hysteria2 download bandwidth using wrong field name (bandwidth.download_bandwidthbandwidth.down); add missing obfs (salamander) support
  • Stash.php: Enable AnyTLS support (was commented out); fix AnyTLS TLS field path (tls_settings.*tls.*); add missing Hysteria2 obfs support
  • Clash.php: Add VLESS (TLS/Reality/ws/grpc), Hysteria/Hysteria2 (with obfs), and AnyTLS protocol support — these were already in ClashMeta but missing from the plain Clash protocol handler

Details

Loon.php — Hysteria2 bandwidth field name

The XBoard protocol_settings.bandwidth object uses up/down keys (matching ClashMeta, Stash, SingBox), but Loon's buildHysteria() was reading bandwidth.download_bandwidth which doesn't exist, resulting in empty download-bandwidth= in the subscription output.

Stash.php — AnyTLS commented out + wrong TLS path

  1. The AnyTLS handler in handle() was fully commented out, so AnyTLS nodes were silently dropped from Stash subscriptions even though allowedProtocols included it.
  2. buildAnyTLS() used tls_settings.server_name / tls_settings.allow_insecure, but AnyTLS (like Hysteria/TUIC) stores TLS config under tls.*, not tls_settings.*. This caused SNI and skip-cert-verify to always be null/false.

Stash.php + Loon.php — Missing Hysteria2 obfs

Neither file handled Hysteria2 obfs (salamander), so nodes with obfs enabled would connect without obfs and fail if the server requires it.

Clash.php — Missing VLESS/Hysteria/AnyTLS

allowedProtocols only listed ss/vmess/trojan/socks/http. Build methods for VLESS, Hysteria, and AnyTLS were missing entirely. Added them following the same patterns used in ClashMeta.php.

Test plan

  • Verify Loon subscription includes correct download-bandwidth= value for Hysteria2 nodes
  • Verify Stash subscription includes AnyTLS nodes with correct SNI
  • Verify Stash Hysteria2 nodes include obfs fields when enabled
  • Verify Clash subscription includes VLESS, Hysteria2, and AnyTLS nodes
  • Verify existing protocols (ss/vmess/trojan/socks/http) are unaffected

🤖 Generated with Claude Code

Loon.php:
- Fix Hysteria2 download bandwidth field: `bandwidth.download_bandwidth` → `bandwidth.down`
- Add missing Hysteria2 obfs (salamander) support

Stash.php:
- Enable AnyTLS protocol support (was commented out)
- Fix AnyTLS TLS field path: `tls_settings.server_name` → `tls.server_name`
  (AnyTLS uses `tls.*` not `tls_settings.*` like VMess/Trojan)
- Add missing Hysteria2 obfs support

Clash.php:
- Add VLESS protocol support (with TLS/Reality/ws/grpc)
- Add Hysteria/Hysteria2 protocol support (with obfs)
- Add AnyTLS protocol support

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