Files
mirror-3x-ui/internal/sub/shadowrocket.go
T
TingChieh 3f7e77e6f8 fix(sub): give Shadowrocket a base64url userinfo for Shadowsocks 2022 links (#7148)
For a 2022-blake3 method the raw subscription percent-encodes the
userinfo, as SIP022 requires. Shadowrocket copies the %2B, %2F and %3D
escapes into the node password as they are, so authentication fails for
every key that contains +, / or =.

A request whose User-Agent is Shadowrocket now gets the userinfo as
base64url, the form the other Shadowsocks methods already use and that
Shadowrocket reads. Every other client keeps the SIP022 form.

Closes #7146
2026-11-24 03:51:32 +03:30

11 lines
300 B
Go

package sub
import "regexp"
var shadowrocketUserAgentRegex = regexp.MustCompile(`(?i)\bshadowrocket`)
// IsShadowrocketClient checks if the client user-agent identifies as Shadowrocket.
func IsShadowrocketClient(userAgent string) bool {
return shadowrocketUserAgentRegex.MatchString(userAgent)
}