Skip to content

Instantly share code, notes, and snippets.

@vimagick
Created March 16, 2024 15:12
Show Gist options
  • Save vimagick/2973a938d9bfab37a988dc760a2f3ad6 to your computer and use it in GitHub Desktop.
Save vimagick/2973a938d9bfab37a988dc760a2f3ad6 to your computer and use it in GitHub Desktop.
#!/bin/bash
yq -o json | jq -r '
.proxies[] |
if .type == "ss" then
(["ss://", ("\(.cipher):\(.password)"|@base64), "@\(.server):\(.port)"] | join(""))
elif .type == "vmess" then
({v:"2", ps:.name, add:.server, port:.port, id:.uuid, aid:.alterId, scy:.cipher, net:.network, host:.["ws-opts"].headers.Host, path:.["ws-opts"].path, tls:(if .tls then "tls" else "" end)} | "vmess://\(.|@json|@base64)")
elif .type == "trojan" then
("trojan://\(.password)@\(.server):\(.port)?sni=\(.sni)&allowInsecure=1" + (if .network == "ws" then "&type=\(.network)&path=\(.["ws-opts"].path)" else "" end))
else
empty
end
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment