Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
shadowsocks-org#27
node v4.9.1
endpoint
share
tweet
Illustrate Matrix-URI parameters scheme parsing
const { parse } = require('url'); const uri = 'ss://passwd:method@hostname:7070/kcptun;mode=fast;crypt=aes/obfs;host=foobar.io'; const { protocol, auth, hostname, port, pathname } = parse(uri); console.info(protocol, auth, hostname, port); const plugins = pathname .split('/') .filter(Boolean) .map(s => s.replace(';', '?').replace(/;/g, '&')) .map(s => parse(s, true)) .map(({pathname, query}) => ({[pathname]: query})) ; const options = Object.assign({}, ...plugins); console.log(options);
Loading…
no comments
sign in
to comment