v2conf


Namev2conf JSON
Version 0.1.9 PyPI version JSON
download
home_pagehttps://github.com/mahyar24/V2Conf/
SummaryV2Conf helps you build V2Ray Config file automatically and evaluate and change config rules based on outbounds performances.
upload_time2024-06-20 01:52:58
maintainerNone
docs_urlNone
authorMahyar Mahdavi
requires_python<4.0,>=3.9
licenseGPL-3.0-or-later
keywords v2ray v2fly x2ray
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # V2Conf

V2Conf helps you build V2Ray configuration files automatically and evaluate and modify configuration rules based on outbound performance.
## Installation & Running

```bash
sudo apt-get install pipx && pipx install --python python3.9 v2conf;
sudo $(which v2conf) /home/ubuntu/confs -n 10 --no-geoip --country-code 'IR' --jalali --log-file /home/ubuntu/v2conf.log 
```

## Recommended Usage
```bash
sudo $(which v2conf) /home/ubuntu/confs -n 5 -s 900 --timeout-penalty 10 --ema 8,1.25 --no-geoip --country-code 'IR' --log-level error --jalali -w "https://dl-cdn.alpinelinux.org/alpine/v3.17/releases/x86/alpine-minirootfs-3.17.1-x86.tar.gz" --log-file /home/ubuntu/v2conf.log 
```
With these flags and settings, V2Conf will download the selected file every 15 minutes (900 / 60 = 15) 10 times for each outbound.\
V2Conf will print logs in Jalali date times in `/home/ubuntu/v2conf.log` and `stdout` simultaneously and it will exclude IPs for Iran. (useful for domestic Iranian VPSs) \
`--timeout-penalty 15` makes the program to consider a failed test as a test with 15 seconds latency and based on exponential moving average of last `8` evaluations (past 2 hours) and weighting more importance on recent evaluations (`2` times for every new evaluation) choose the best outbound and route all data within that.\
`--log-level error` indicates that **V2Ray** log level will be `error`.\
For using it with `xray` you can specify `-c /usr/local/etc/xray/config.json` and `-p xray` flags.\

## Details

V2Conf expects a directory with this structure from you:
```bash
confs/
├── inbounds  # an "inbounds" directory
│   └── main_entry.json
├── outbounds  # an "outbounds" directory
│   ├── blocked.json
│   ├── direct.json
│   ├── trojan_h2.json
│   ├── trojan_ws_cloudflare.json
│   ├── vless_h2.json
│   └── vless_ws_cloudflare.json
└── rules  # a "rules" directory
    ├── ir.json
    └── private.json
```
where each inbound, outbound or rule should be saved as a json file (*.json).
e.g. `main_entry.json`:
```json
{
  "port": 6060,
  "protocol": "trojan",
  "settings": {
    "clients":
    ...
```
and **all configs must have a tag!**
P.S.: Thanks to [Tushar](https://github.com/Mahyar24/V2Conf/pull/2) V2Conf now supports JSON5 format for configs.


## Usage
```
usage: v2conf [-h] [-c CONFIG_FILE] [-p PROCESS_NAME] [--country-code COUNTRY_CODE] [--no-geoip] [-t TIMEOUT] [-w WEBSITE] [-n NUM_OF_TRIES] [--timeout-penalty TIMEOUT_PENALTY] [--ema EMA] [-s SLEEP_TIME]
                   [-l {debug,info,warning,error,none}] [-q | --log-file LOG_FILE] [--jalali] [--stats] [--stats-port STATS_PORT] [--sys-only | --users-only] [-v]
                   [path_conf_dir]

positional arguments:
  path_conf_dir         Select configuration directory, default is $PWD.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Select configuration file, default is '/usr/local/etc/v2ray/config.json'.
  -p PROCESS_NAME, --process-name PROCESS_NAME
                        Select the process name, default is 'v2ray'. If you are using 'xray' set it here and in the custom config file path in '-c' flag.
  --country-code COUNTRY_CODE
                        Exclude a country from the list of IPs to be routed; default is 'IR'. (ISO 3166-1 alpha-2)
  --no-geoip            Instead of using V2Ray GeoIP database, downloading IPs from 'ripe.net' (more recent IPs but may slow V2Ray)
  -t TIMEOUT, --timeout TIMEOUT
                        Set the timeout for checking the health of proxies, default is 15 seconds.
  -w WEBSITE, --website WEBSITE
                        Set the website to be used for checking the health of proxies, default is 'https://facebook.com'.
  -n NUM_OF_TRIES, --num-of-tries NUM_OF_TRIES
                        Set the number of tries for checking the health of proxies, default is 10.
  --timeout-penalty TIMEOUT_PENALTY
                        Converting timeouts to latency by this factor (in seconds), DISABLED by default.
  --freedom-tag FREEDOM_TAG
                        Explicitly set the tag for the freedom (direct) outbound.
  --ema EMA             Instead of choosing OutBound based on latest evaluation, rank based on exponential moving average of last Nth tests and smoothing variable. (e.g. --ema 10,2.5) DISABLED by default.
  -s SLEEP_TIME, --sleep-time SLEEP_TIME
                        Set the sleep time between each checkup, default is 1,800s. (in seconds)
  -l {debug,info,warning,error,none}, --log-level {debug,info,warning,error,none}
                        Set the V2Ray log level, default is 'warning'.
  -q, --quiet           No log file (V2Conf). (printing to stdout anyway)
  --log-file LOG_FILE   Path for V2Conf log file. default is '$PWD/V2Conf.log'
  --jalali              Use Jalali datetime for V2Conf logging
  --stats               Activating traffic statistics
  --stats-port STATS_PORT
                        Set the port for statistics API. Default is: 10085
  --sys-only            Only system traffic statistics
  --users-only          Only users traffic statistics
  -v, --version         Show version and exit.

Written by: Mahyar Mahdavi <Mahyar@Mahyar24.com>. License: GNU GPLv3. Source Code: <https://github.com/mahyar24/V2Conf>. Reporting Bugs and PRs are welcomed. :)

```
## More Tools
Check out these Gist files for more tools:

- [V2Ray-Traffic](https://gist.github.com/Mahyar24/0751f08969ccb0aab54ae80a0f80daff) - a script for monitoring V2Ray traffic.
- [V2Ray-Abnormal](https://gist.github.com/Mahyar24/d712a30a35576e5b8584c562e15e550c) - a script for monitoring V2Ray abnormal IP connections.
- [V2Ray-Abnormal-Polars](https://gist.github.com/Mahyar24/ff11ed7973bbe3a37b1caedef40ff850) - a script for monitoring V2Ray abnormal IP connections implemented with Polars.
- [V2Ray-IP-GeoLocation](https://gist.github.com/Mahyar24/1e04c46b27314de0475a4b9f72b3285f) - a script for checking IP GeoLocations of users. 

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Contact me: <OSS@Mahyar24.com> :)

## License
[GNU GPLv3](https://choosealicense.com/licenses/gpl-3.0/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mahyar24/V2Conf/",
    "name": "v2conf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "V2Ray, V2Fly, X2Ray",
    "author": "Mahyar Mahdavi",
    "author_email": "Mahyar@Mahyar24.com",
    "download_url": "https://files.pythonhosted.org/packages/1c/83/bceff85d36fc5bfc8adc6e85f6ffaa9a57a2ef5976cbfd4b92631c23ee5e/v2conf-0.1.9.tar.gz",
    "platform": null,
    "description": "# V2Conf\n\nV2Conf helps you build V2Ray configuration files automatically and evaluate and modify configuration rules based on outbound performance.\n## Installation & Running\n\n```bash\nsudo apt-get install pipx && pipx install --python python3.9 v2conf;\nsudo $(which v2conf) /home/ubuntu/confs -n 10 --no-geoip --country-code 'IR' --jalali --log-file /home/ubuntu/v2conf.log \n```\n\n## Recommended Usage\n```bash\nsudo $(which v2conf) /home/ubuntu/confs -n 5 -s 900 --timeout-penalty 10 --ema 8,1.25 --no-geoip --country-code 'IR' --log-level error --jalali -w \"https://dl-cdn.alpinelinux.org/alpine/v3.17/releases/x86/alpine-minirootfs-3.17.1-x86.tar.gz\" --log-file /home/ubuntu/v2conf.log \n```\nWith these flags and settings, V2Conf will download the selected file every 15 minutes (900 / 60 = 15) 10 times for each outbound.\\\nV2Conf will print logs in Jalali date times in `/home/ubuntu/v2conf.log` and `stdout` simultaneously and it will exclude IPs for Iran. (useful for domestic Iranian VPSs) \\\n`--timeout-penalty 15` makes the program to consider a failed test as a test with 15 seconds latency and based on exponential moving average of last `8` evaluations (past 2 hours) and weighting more importance on recent evaluations (`2` times for every new evaluation) choose the best outbound and route all data within that.\\\n`--log-level error` indicates that **V2Ray** log level will be `error`.\\\nFor using it with `xray` you can specify `-c /usr/local/etc/xray/config.json` and `-p xray` flags.\\\n\n## Details\n\nV2Conf expects a directory with this structure from you:\n```bash\nconfs/\n\u251c\u2500\u2500 inbounds  # an \"inbounds\" directory\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 main_entry.json\n\u251c\u2500\u2500 outbounds  # an \"outbounds\" directory\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 blocked.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 direct.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 trojan_h2.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 trojan_ws_cloudflare.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 vless_h2.json\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 vless_ws_cloudflare.json\n\u2514\u2500\u2500 rules  # a \"rules\" directory\n    \u251c\u2500\u2500 ir.json\n    \u2514\u2500\u2500 private.json\n```\nwhere each inbound, outbound or rule should be saved as a json file (*.json).\ne.g. `main_entry.json`:\n```json\n{\n  \"port\": 6060,\n  \"protocol\": \"trojan\",\n  \"settings\": {\n    \"clients\":\n    ...\n```\nand **all configs must have a tag!**\nP.S.: Thanks to [Tushar](https://github.com/Mahyar24/V2Conf/pull/2) V2Conf now supports JSON5 format for configs.\n\n\n## Usage\n```\nusage: v2conf [-h] [-c CONFIG_FILE] [-p PROCESS_NAME] [--country-code COUNTRY_CODE] [--no-geoip] [-t TIMEOUT] [-w WEBSITE] [-n NUM_OF_TRIES] [--timeout-penalty TIMEOUT_PENALTY] [--ema EMA] [-s SLEEP_TIME]\n                   [-l {debug,info,warning,error,none}] [-q | --log-file LOG_FILE] [--jalali] [--stats] [--stats-port STATS_PORT] [--sys-only | --users-only] [-v]\n                   [path_conf_dir]\n\npositional arguments:\n  path_conf_dir         Select configuration directory, default is $PWD.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CONFIG_FILE, --config-file CONFIG_FILE\n                        Select configuration file, default is '/usr/local/etc/v2ray/config.json'.\n  -p PROCESS_NAME, --process-name PROCESS_NAME\n                        Select the process name, default is 'v2ray'. If you are using 'xray' set it here and in the custom config file path in '-c' flag.\n  --country-code COUNTRY_CODE\n                        Exclude a country from the list of IPs to be routed; default is 'IR'. (ISO 3166-1 alpha-2)\n  --no-geoip            Instead of using V2Ray GeoIP database, downloading IPs from 'ripe.net' (more recent IPs but may slow V2Ray)\n  -t TIMEOUT, --timeout TIMEOUT\n                        Set the timeout for checking the health of proxies, default is 15 seconds.\n  -w WEBSITE, --website WEBSITE\n                        Set the website to be used for checking the health of proxies, default is 'https://facebook.com'.\n  -n NUM_OF_TRIES, --num-of-tries NUM_OF_TRIES\n                        Set the number of tries for checking the health of proxies, default is 10.\n  --timeout-penalty TIMEOUT_PENALTY\n                        Converting timeouts to latency by this factor (in seconds), DISABLED by default.\n  --freedom-tag FREEDOM_TAG\n                        Explicitly set the tag for the freedom (direct) outbound.\n  --ema EMA             Instead of choosing OutBound based on latest evaluation, rank based on exponential moving average of last Nth tests and smoothing variable. (e.g. --ema 10,2.5) DISABLED by default.\n  -s SLEEP_TIME, --sleep-time SLEEP_TIME\n                        Set the sleep time between each checkup, default is 1,800s. (in seconds)\n  -l {debug,info,warning,error,none}, --log-level {debug,info,warning,error,none}\n                        Set the V2Ray log level, default is 'warning'.\n  -q, --quiet           No log file (V2Conf). (printing to stdout anyway)\n  --log-file LOG_FILE   Path for V2Conf log file. default is '$PWD/V2Conf.log'\n  --jalali              Use Jalali datetime for V2Conf logging\n  --stats               Activating traffic statistics\n  --stats-port STATS_PORT\n                        Set the port for statistics API. Default is: 10085\n  --sys-only            Only system traffic statistics\n  --users-only          Only users traffic statistics\n  -v, --version         Show version and exit.\n\nWritten by: Mahyar Mahdavi <Mahyar@Mahyar24.com>. License: GNU GPLv3. Source Code: <https://github.com/mahyar24/V2Conf>. Reporting Bugs and PRs are welcomed. :)\n\n```\n## More Tools\nCheck out these Gist files for more tools:\n\n- [V2Ray-Traffic](https://gist.github.com/Mahyar24/0751f08969ccb0aab54ae80a0f80daff) - a script for monitoring V2Ray traffic.\n- [V2Ray-Abnormal](https://gist.github.com/Mahyar24/d712a30a35576e5b8584c562e15e550c) - a script for monitoring V2Ray abnormal IP connections.\n- [V2Ray-Abnormal-Polars](https://gist.github.com/Mahyar24/ff11ed7973bbe3a37b1caedef40ff850) - a script for monitoring V2Ray abnormal IP connections implemented with Polars.\n- [V2Ray-IP-GeoLocation](https://gist.github.com/Mahyar24/1e04c46b27314de0475a4b9f72b3285f) - a script for checking IP GeoLocations of users. \n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nContact me: <OSS@Mahyar24.com> :)\n\n## License\n[GNU GPLv3](https://choosealicense.com/licenses/gpl-3.0/)\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "V2Conf helps you build V2Ray Config file automatically and evaluate and change config rules based on outbounds performances.",
    "version": "0.1.9",
    "project_urls": {
        "Homepage": "https://github.com/mahyar24/V2Conf/",
        "Repository": "https://github.com/Mahyar24/V2Conf/"
    },
    "split_keywords": [
        "v2ray",
        " v2fly",
        " x2ray"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eaea240c5a52142230d8fcc7dee6dad037054357eb7729b8415e8e3eceb9c75e",
                "md5": "492dc0fbb49c4774062b3cdfe78c5f0c",
                "sha256": "4e9db88e9ca245496cba3ea92f5adb724d4a801fa6486a75f27eec34a248ff9d"
            },
            "downloads": -1,
            "filename": "v2conf-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "492dc0fbb49c4774062b3cdfe78c5f0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 27291,
            "upload_time": "2024-06-20T01:52:55",
            "upload_time_iso_8601": "2024-06-20T01:52:55.614859Z",
            "url": "https://files.pythonhosted.org/packages/ea/ea/240c5a52142230d8fcc7dee6dad037054357eb7729b8415e8e3eceb9c75e/v2conf-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c83bceff85d36fc5bfc8adc6e85f6ffaa9a57a2ef5976cbfd4b92631c23ee5e",
                "md5": "5394fe29f8e12c01a59edef9dadccbda",
                "sha256": "3a85279ea64f4a817eb041b6d0d2b819b1dc2a7e4bf4977a21515604906175c4"
            },
            "downloads": -1,
            "filename": "v2conf-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "5394fe29f8e12c01a59edef9dadccbda",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 26533,
            "upload_time": "2024-06-20T01:52:58",
            "upload_time_iso_8601": "2024-06-20T01:52:58.201154Z",
            "url": "https://files.pythonhosted.org/packages/1c/83/bceff85d36fc5bfc8adc6e85f6ffaa9a57a2ef5976cbfd4b92631c23ee5e/v2conf-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-20 01:52:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mahyar24",
    "github_project": "V2Conf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "v2conf"
}
        
Elapsed time: 1.33834s