#!/usr/bin/env dash # vless to v2ray config converter # author: touka@nopwd.lol # version: 0.2 # ============================ # FIRST READ THE SCRIPT!! echo "FIRST READ THE SCRIPT!!" exit # ============================ # -- change it to your needs -- port=2081 protocol='http' # ----------------------------- set -e if [ "$#" -ne 1 ]; then echo "Usage: dash $0 vless.txt > config.json " exit fi user=$(trurl -g '{user}' -f $1 ) address=$(trurl -g '{host}' -f $1) out_port=$(trurl -g '{port}' -f $1) path=$(trurl -g '{query:path}' -f $1) security=$(trurl -g '{query:security}' -f $1) encryption=$(trurl -g '{query:encryption}' -f $1) host=$(trurl -g '{query:host}' -f $1) fp=$(trurl -g '{query:fp}' -f $1) type=$(trurl -g '{query:type}' -f $1) name=$(trurl -g '{fragment}' -f $1) if [ -z "$encryption" ]; then encryption="none" fi echo " { \"log\": { \"loglevel\": \"warning\" }, \"inbounds\" : [ { \"listen\" : \"127.0.0.1\", \"port\" : $port, \"protocol\" : \"$protocol\", \"settings\" : { \"auth\" : \"noauth\", \"udp\" : true }, \"sniffing\" : { \"destOverride\" : [ \"http\", \"tls\", \"quic\", \"fakedns\" ], \"enabled\" : false, \"routeOnly\" : true }, \"tag\" : \"http\" } ], \"outbounds\" : [ { \"protocol\" : \"vless\", \"settings\" : { \"vnext\" : [ { \"address\" : \"$address\", \"port\" : $out_port, \"users\" : [ { \"encryption\" : \"$encryption\", \"id\" : \"$user\" } ] } ] }, \"streamSettings\" : { \"network\" : \"$type\", \"security\" : \"$security\", \"tlsSettings\": { \"fingerprint\": \"$fp\", \"servername\": \"$host\" }, \"wsSettings\" : { \"headers\" : { \"Host\" : \"$host\" }, \"path\" : \"$path\" } }, \"tag\" : \"proxy\" }, { \"protocol\" : \"freedom\", \"tag\" : \"direct\" }, { \"protocol\" : \"blackhole\", \"tag\" : \"block\" } ] } "