Skip to content

add Shadowsocks (ss://) support#86

Open
Hoot-Code wants to merge 5 commits into
MatinSenPai:mainfrom
Hoot-Code:main
Open

add Shadowsocks (ss://) support#86
Hoot-Code wants to merge 5 commits into
MatinSenPai:mainfrom
Hoot-Code:main

Conversation

@Hoot-Code
Copy link
Copy Markdown
Contributor

Add Shadowsocks (ss://) support

Summary

This PR adds full Shadowsocks configuration support alongside the existing VLESS and Trojan protocols. Users can now paste a ss:// share URL into the config input and have it scanned and validated like any other protocol.


Changes

internal/xraytest/parser.go

  • Added Method string field to VLESSConfig (holds the cipher, e.g. aes-256-gcm, chacha20-ietf-poly1305)
  • Extended ParseProxyURL to dispatch ss:// URLs to the new parser
  • Added ParseShadowsocks() supporting both URL formats:
    • SIP002 (modern): ss://BASE64(method:password)@host:port#remark
    • Legacy: ss://BASE64(method:password@host:port)#remark
  • Added ToShadowsocksURL() to reconstruct a SIP002 share URL from a parsed config
  • Added ssDecodeUserinfo() and base64DecodeSS() helpers that tolerate missing padding and both standard/URL-safe base64 alphabets

internal/xraytest/builder.go

  • Updated buildOutbound() to dispatch on Protocol == "shadowsocks"
  • Added buildShadowsocksOutbound() which generates a valid Xray shadowsocks outbound block with method and password

internal/ui/model.go

  • Updated config input placeholder to include ss://

internal/xraytest/parser_test.go

  • Added 5 new tests: SIP002 parsing, legacy parsing, dispatch via ParseProxyURL, round-trip via ToShadowsocksURL, and invalid port rejection

Supported ciphers

Any cipher string is accepted (the value is passed through to Xray). Common ones include:
aes-128-gcm · aes-256-gcm · chacha20-ietf-poly1305 · xchacha20-ietf-poly1305 · 2022-blake3-aes-256-gcm


Testing

go test ./internal/xraytest/...

All existing tests continue to pass. New tests cover both URL formats, the dispatch layer, round-trip URL generation, and error handling.

@Hoot-Code Hoot-Code closed this Jun 5, 2026
@Hoot-Code Hoot-Code reopened this Jun 5, 2026
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