mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-20 13:03:50 +00:00
shadowsocks-rust takes a whole server definition as a URL; libev could only be given the pieces separately, so importing a server meant taking a URL apart by hand. ss-local now accepts --server-url and reads the address, port, cipher, password and SIP003 plugin from it. Both encodings are handled: the SIP002 form with the userinfo in base64url, and the older form where the whole body is one base64 blob. The userinfo is also accepted in the clear, because that is what shadowsocks-rust's `ssurl` emits for the 2022 ciphers, whose base64 pre-shared keys it percent-encodes instead. IPv6 literals, a trailing slash, the plugin query and the '#' tag are all covered. Options given later on the command line still win, since they are applied as getopt reaches them. ssurl.c sits with the ss-local sources rather than the shared ones: it depends on base64.c, which ss-manager does not link. The tests include URLs copied verbatim from `ssurl --encode` output, so the parser is pinned against what another implementation really produces rather than only against my reading of the spec. Verified end to end by pointing ss-local at a rust-generated URL and proxying through their ssserver.