Commit Graph
1 Commits
  • fix(link): rebuild shadowsocks tcp/http obfuscation on import (#6505)
    * fix(link): rebuild shadowsocks tcp/http obfuscation on import
    
    genShadowsocksLink encodes tcp/http obfuscation only as the SIP002
    plugin=obfs-local;obfs=http;obfs-host=... parameter, deleting type, headerType,
    path and host in the process, because SIP002 clients ignore those and read
    `plugin` alone. ParseLink read none of them, so importing a link the panel had
    just exported produced a plain tcp outbound with header.type none: the
    obfuscation the inbound requires was gone, and the client could not connect to
    the very inbound the link came from.
    
    The plugin is now mapped back onto the header it stands for. Credentials and
    every other parameter are untouched, and other plugin values are left as they
    were because Xray has no equivalent for them.
    
    * fix(link): map the SIP002 plugin in both importers
    
    The panel parses share links twice: link.ParseLink in Go, which the external
    subscriptions use, and parseShadowsocksLink in outbound-link-parser.ts, which
    the Add Outbound button calls. Mapping the plugin in Go alone left the UI path
    still saving header.type none for a link the panel had exported itself, so one
    panel answered the same link with two different outbounds.
    
    The unencoded plugin=obfs-local;obfs=http;... form maps as well now: stdlib
    drops any query pair whose value holds a literal semicolon, and that is the
    shape clients which skip percent-encoding emit, so the raw query is read as a
    fallback when the parsed parameter is missing.