Skip to content

json2vmess

Preston edited this page Oct 26, 2019 · 1 revision

json2vmess

json2vmess.py works oppositely, parses a server side json and prints vmess:// links.

Usage

./json2vmess.py --help
usage: json2vmess.py [-h] [-a ADDR] json

json2vmess convert server side json into vmess links

positional arguments:
  json                  parse the server side json

optional arguments:
  -h, --help            show this help message and exit
  --addr ADDR           server address. If not specified, program will detect
                        the current IP
  --filter FILTER       Protocol Filter, useful for inbounds with different
                        protocols. FILTER starts with ! means negative
                        selection. Multiple filter is accepted.
  -a AMEND, --amend AMEND
                        Amend to the output values, can be use multiple times.
                        eg: -a port:80 -a ps:amended
  --debug               debug mode, show vmess obj

Example

#just list the links (on server)
./json2vmess.py /etc/v2ray/config.json 

# if using h2/ws protocols, auto detected IP is not working, manually specify it
./json2vmess.py --addr my.v2ray.domain.net /etc/v2ray/config.json 

# json file has multiple inbounds with different protocols
# output those ws and h2 and replace to port 443 for the caddy/nginx is proxying the websocket at 443
./json2vmess.py --addr my.v2ray.domain.net --filter ws --amend port:443 --debug  /etc/v2ray/config.json 

# use raw IP address for kcp and tcp connections 
./json2vmess.py --addr 2001:1234:5678::9999 --filter kcp -f tcp --debug  /etc/v2ray/config.json

# or just any protocols other than websocket
./json2vmess.py --addr 2001:1234:5678::9999 --filter \!ws --debug  /etc/v2ray/config.json
Clone this wiki locally