Giter VIP home page Giter VIP logo

v2ray_toolbox's Introduction

v2ray subscription toolbox

This toolbox contains python scripts to generate files that can be used in v2rayN to subscribe v2ray servers and also qrcode for ShadowRocket. It follows the format introduced in v2rayN wiki. It only supports http\websocket\kcp\http2 but not quic.

Requirement

  • python3
  • urllib

Tutorial

  1. Prepare the configuration files of your v2ray servers, for example config.json and config2.json. Put them in the same folder of these python scripts
  2. Run the following commands to generate v2rayN format configuration file
python3 conf2vmess.py -c config.json -s example.com -p 443 -o vmess.json
python3 conf2vmess.py -c config2.json -s example2.com -p 8443 -o vmess.json -a

The file vmess.json looks like the following:

[
    {
        "v": "2",
        "ps": "",
        "add": "example.com",
        "port": "443",
        "id": GUID,
        "aid": "64",
        "net": "ws",
        "type": "none",
        "host": "",
        "path": "/",
        "tls": "tls"
    },
    {
        "v": "2",
        "ps": "",
        "add": "example2.com",
        "port": "8443",
        "id": "GUID",
        "aid": "64",
        "net": "ws",
        "type": "none",
        "host": "",
        "path": "/",
        "tls": "tls"
    }
]
  1. Edit vmess.json manually if you need. (E.g. add unique labels to the ps field of each server)
  2. Run the following command to generate v2rayN format vmess link vmess_v2rayN.lnk and html file for subscription vmess_v2rayN.html
python3 vmess2sub.py vmess.json vmess_v2rayN.html -l vmess_v2rayN.lnk

The file vmess_v2rayN.lnk looks like the following:

vmess://XXX
vmess://XXX
  1. Run the following command to generate ShadowRocket format vmess link vmess_sr.lnk and html file for subscription vmess_sr.html
python3 vmess2sub.py vmess.json vmess_sr.html -l vmess_sr.lnk -t sr
  1. Upload the two html files to some location of your server, for example http://example.com/vmess_v2rayN.html and http://example.com/vmess_sr.html
  2. For v2rayN, you can directly use http://example.com/vmess_v2rayN.html
  3. For ShadowRocket, you can run the following command to generate a qrcode
qrencode -l H -o qrcode.png $(python3 sub2srlink.py http://admin:[email protected]/vmess_sr.html)
  1. Share the qrcode

Usage

  • conf2vmess.py
usage: conf2vmess.py [-h] [-c CONFIG] [-s SERVER] [-p PORT [PORT ...]]
                     [-o OUTPUT] [-a]

Script to generate v2rayN format configuration file based on https://github.co
m/2dust/v2rayN/wiki/%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5%E6%A0%BC%E5%BC%8F%E8%
AF%B4%E6%98%8E(ver-2)

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        path of configuration file for v2ray server (default:
                        config.json)
  -s SERVER, --server SERVER
                        domain or IP address of v2ray server (default: IP of
                        current host 67.230.177.23)
  -p PORT [PORT ...], --port PORT [PORT ...]
                        ports that v2ray server listens to (default: the ones
                        defined in configuration file)
  -o OUTPUT, --output OUTPUT
                        name of v2rayN format configuration file (default:
                        STDOUT)
  -a, --append          append to output file (default: False)
  • vmess2sub.py
usage: vmess2sub.py [-h] [-l LINK] [-t {v2rayN,sr}] CONF OUTPUT

generate vmess links from v2rayN configuration file

positional arguments:
  CONF                  v2rayN configration file
  OUTPUT                HTML file for subscription

optional arguments:
  -h, --help            show this help message and exit
  -l LINK, --link LINK  file to store vmess links (default: STDOUT)
  -t {v2rayN,sr}        type of vmess link (default: v2rayN)
  • sub2srlink.py
usage: sub2srlink.py [-h] LINK

generate link for subscription in ShadowRocket

positional arguments:
  LINK        url of the html file, e.g.:
              http://admin:[email protected]/v2ray.html

optional arguments:
  -h, --help    show this help message and exit
  -l, --label   a label to distinguish different subscription links served on the same server

Liscense

GPL3.0

v2ray_toolbox's People

Contributors

machsix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.