{"id":20541075,"url":"https://github.com/sonyacore/v2raygen","last_synced_at":"2025-12-16T01:39:39.555Z","repository":{"id":61009070,"uuid":"542834202","full_name":"SonyaCore/V2RayGen","owner":"SonyaCore","description":"XRayGen for generating XRay JSON configs","archived":true,"fork":false,"pushed_at":"2024-11-24T01:11:58.000Z","size":5629,"stargazers_count":289,"open_issues_count":2,"forks_count":37,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-14T22:29:09.557Z","etag":null,"topics":["censorship","freedom","v2ray","v2ray-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SonyaCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-28T23:35:20.000Z","updated_at":"2025-04-11T08:04:13.000Z","dependencies_parsed_at":"2023-10-15T21:14:04.411Z","dependency_job_id":"d32bbb09-5558-4b57-a6b3-31e1165bae28","html_url":"https://github.com/SonyaCore/V2RayGen","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/SonyaCore/V2RayGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonyaCore%2FV2RayGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonyaCore%2FV2RayGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonyaCore%2FV2RayGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonyaCore%2FV2RayGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SonyaCore","download_url":"https://codeload.github.com/SonyaCore/V2RayGen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonyaCore%2FV2RayGen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270940328,"owners_count":24671669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["censorship","freedom","v2ray","v2ray-plugin"],"created_at":"2024-11-16T01:19:13.311Z","updated_at":"2025-12-16T01:39:39.486Z","avatar_url":"https://github.com/SonyaCore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e XRayGen\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![Telegram][telegram-shield]][telegram-url]\n\n\u003c/h1\u003e\n\n\u003ch3\u003e\u003cstrong\u003eV2RayGen/XRayGen\u003c/strong\u003e: A Fast and Automated Script for XRay/V2Ray Server Setup\u003c/h3\u003e\n\n[**Usage**](#usage)\n\n[**Quick Setup**](#quicksetup)\n\n[**Examples**](#examples)\n\n[**Options**](#options)\n\n[**Block List**](#blocklist)\n\n[**License**](#license)\n\n[**Donate Me**](#donateme)\n\n## **Prerequisites \u0026 Dependencies**\n\n- `Python3`\n- `Docker`\n- `Docker Compose`\n\u003cp\u003eIf your server lacks Docker and Docker-Compose, the script will install them and launch XRay-Core automatically.\u003c/p\u003e\n\nuse **sudo** if your current user is not in the docker group or you don't have docker installed\n\n## **How Does XRayGen Work?**\n\n\u003cp\u003eXRayGen uses Docker to retrieve the xray-core image from the Docker registry. It then generates a configuration file to launch the XRay container.\n\nA client-side configuration file is also created for use with XRay-core or V2Ray-core.\n\nThe XRayAgent provides user management for XRay configuration, offering CRUD operations.\u003c/p\u003e\n\n## **Usage**\n\n`curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 - -h`\n\n![Sample](contents/content1.png)\n\n\u003cbr\u003e\n\n## **QuickSetup**\n\nYou can use one of the following protocols for installation and change its settings according to your needs.\n\n| Protoctol           | Argument             |\n| ------------------- | -------------------- |\n| VMESS WS            | --vmess              |\n| VMESS WS TLS        | --vmess --tls        |\n| VMESS TCP           | --vmess --tcp        |\n| VMESS TCP TLS       | --vmess --tcp --tls  |\n| VLESS WS TLS        | --vless              |\n| VLESS TCP TLS       | --vless --tcp        |\n| VLESS TCP XTLS      | --vless --tcp --xtls |\n| TROJAN WS TLS       | --trojan             |\n| TROJAN TCP TLS      | --trojan --tcp       |\n| TROJAN TCP XTLS     | --trojan --xtls      |\n| ShadowSocks TCP     | --shadowsocks        |\n| ShadowSocks TCP TLS | --shadowsocks --tls  |\n\n### **Quick `Xray` Setup with Default Setting** :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess\n```\n\nOR\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py --output V2RayGen.py\nsudo python3 V2RayGen.py --vmess\n```\n\n![Sample](contents/content3.png)\n\n\u003cp\u003eUse the provided link for your client, or use the client-side JSON configuration with XRay-Core or V2Ray-Core. If your server is on a domain, simply change the IP to your domain or subdomain after importing the link to your V2Ray client.\u003c/p\u003e\n\n# **Examples**\n\n**Setup XRAY / ShadowSocks :**\n\nVLESS :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vless\n```\n\nVMESS + TLS with blocking option :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tls --block\n```\n\nVMESS + TLS with blocking iranian domains and IPs option :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tls --blockir\n```\n\nVMESS + Changing client-side HTTP and SOCKS port :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --chttp 4020 --csocks 8080\n```\n\nVMESS + TCP Network Stream :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tcp\n```\n\nVMESS + TCP Network Stream + TLS and QRCode :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tcp --tls --qrcode\n```\n\nVLESS + Using Google DNS :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vless --dns google\n```\n\nVLESS + TCP + XTLS :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vless --tcp --xtls\n```\n\nShadowSocks + adding shadowsocks port to server :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --shadowsocks --firewall\n```\n\n**Parsing Configuration :**\n\nParse \u0026 reading Configuration file :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 - --parseconfig config.json\n```\n\nParse URL and read information :\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 -  --parse vmess://eyJhZGQiOiIxMjcuMC4wLjEiLCJhaWQiOiIwIiwiaG9zdCI6IiIsImlkIjoiM2JlNjE2NzktOGQzOC00ZWJiLWJjOGItMTQ4ZjE0ZWY5ZTc3IiwibmV0Ijoid3MiLCJwYXRoIjoiL2dyYXBocWwiLCJwb3J0IjoiNDQzIiwicHMiOiJ4cmF5IiwidGxzIjoidGxzIiwidHlwZSI6Im5vbmUiLCJ2IjoiMiIgfQ==\n```\n\n---\n\n# **XRayAgent**\n\nXRayAgent is a Simple User Management for XRay Configuration\n\n### Download Script \u0026 Run With Python3:\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py --output /tmp/v.py \u0026\u0026 python3 /tmp/v.py --agent\n```\n\nOR\n\n```bash\ncurl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/XRayAgent.py --output XRayAgent.py\npython3 XRayAgent.py\n```\n\n\u003e By default it loads `config.json` for loading configuration\n\n\u003e For loading other configuration simply enter the name of the configuration after XRayAgent.py :\n\n```bash\npython3 XRayAgent.py config.json\n```\n\n## XRayAgent Commands :\n\n```python3\n  add, adduser                      Adding user\n  update, updateuser                Update existing user with their index ID\n  del, deluser                      Delete existing user with ther index ID\n  users, listusers                  List of users\n\n  deliptables, deleteiptables       Delete rules on server-side port\n  climit , conlimit                 Add IP limitations on server-side port\n\n  p, port                           Change server side port\n  h, help                           Get help\n  v, version                        Get version of program\n  q, quit                           Exit program\n```\n\nafter adding an user a index will be created for that user for example :\n\n```bash\nIndex : 0 {'id': '25ad6df8-9a54-4f6e-8c44-d5685359a7ce', 'level': 0, 'email': 'example@example.com'}\nIndex : 1 {'id': '62bf2d5d-766b-4281-963a-544449a26b4f', 'level': 0, 'email': 'cLkx4WC0@protonmail.com'}\n```\n\nand now you can update that user with ther index ID :\n\n```python3\ncmd \u003e : update 1\nIndex 1 Selected\nLeave the section empty if you don't want to modify that section\nNew Email : test@gmail.com\nNew ID : 62bf2d5d-766b-4281-963a-544449a26b4f\nIndex 1 Updated\nvless://62bf2d5d-766b-4281-963a-544449a26b4f@127.0.0.1:443?path=/graphql\u0026security=tls\u0026encryption=none\u0026type=ws#xray\n```\n\n\u003e Use Index ID for `update` , `del`\n\n\u003e For Showing list of Users and their Indexs use `users` or `listusers` command\n\n\u003cbr\u003e\n\n### IPTABLES Section :\n\nusing `climit` or `conlimit` limits the total connection ips on server side port\n\nfor deleting the all rules on server side port use `deliptables` or `deleteiptables`\n\n---\n\n# **Options**\n\nyou can change server-side configuration with this options\n\n## Server Side\n\n### Protocols\n\n`vmess` Creating vmess with default options.\n\n`vless` Creating VLess with default options.\n\n`shadowsocks` Creating ShadowSocks with default options.\n\n\u003e you can combine arguments with default options to change the behavior of your configuration for example :\n\u003e\n\u003e --vmess --port 8080 --tls --tcp --linkname TESTSERVER\n\u003e\n\u003e this will create a vmess with port 8080 and self-signed tls , then gives a link with TESTSERVER name\n\n### Log \u0026 DNS Settings:\n\n`dns` for using custom dns instead system's default dns configuration.\n\nList of loglevels :\n\n```\ndebug : Information for developers. All \"Info\" included.\n\ninfo : Running stats of XRay，no effect for the functions. All \"Warning\"\nincluded.\n\nwarning : usually some external problem that does not affect V2Ray but possibly the user experience.\n\nerror : XRay encountered a problem that needs to be resolved immediately.\n\nnone : Nothing will be printed.\n```\n\n\u003e ex :\n\u003e\n\u003e --loglevel debug will set your logging level to debug mode\n\u003e\n\u003e logs will be printed on your container docker. you can view the logs with `docker logs \u003ccontainerid\u003e`\n\n**Supported DNS providers:**\n\n\u003e list of avaliable dns's.\n\u003e\n\u003e ex : --dns google will set your server side configuration dns to google\n\n| DNS        |\n| ---------- |\n| google     |\n| cloudflare |\n| opendns    |\n| quad9      |\n| adguard    |\n\n\u003e https://www.v2ray.com/en/configuration/dns.html\n\n### Routing Options\n\n`block` for adding blocking Bittorrent and Ads.\n\n`blockir` for Blocking Bittorrent, Ads and Iranian IPs in routing configuration.\n\n\u003e The routing function module can send inbound data through different outbound connections according to different rules, so as to achieve the purpose of on-demand proxy.\n\n\u003e For example, the common usage is to divert domestic and foreign traffic, Xray can judge the traffic in different regions through the internal mechanism, and then send them to different outbound proxies.\n\n\u003e https://xtls.github.io/config/routing.html#routingobject\n\n### Inbounds\n\n`tls` Using TLS in specified protocol\n\n\u003e tls option can be used for any v2ray protocol for example :\n\u003e\n\u003e --vmess --tls will create a vmess with self-signed tls\n\u003e\n\u003e `it's important to enable allow insecure tls on your client`\n\n`xtls` Using XTLS in specified protocol\n\n\u003e XTLS only supports (TCP, mKCP) so by default when you use --xtls argument tcp mode is being used for vless\n\u003e\n\u003e also xtls doesn't support vmess protocol\n\n`port` for changing configuration port.\n\n\u003e if you want your v2ray to be listening on a different port use this option\n\n`uuid` for using custom uuid configuration.\n\n\u003e by default random uuid will be generated. use this option if you want to have a custom uuid or existing uuid configuration\n\u003e\n\u003e ex : --uuid ca33b7a2-26d6-47b1-a3c4-471425d868b9\n\n`id` custom alterID.\n\n`insecure`, Disable Insecure Encryption. [deprecated]\n\n### Stream Settings:\n\nstream settings is the network type of the stream transport. and by default this script will use websocket for using it with nginx and cdn\n\n`tcp` Using TCP network stream.\n\n`wspath` Changing default WebSocket path configuration.\n\n\u003e default web socket path is /graphql change it with this option.\n\u003e\n\u003e ex :\n\u003e\n\u003e --wspath /myservice\n\n`header` Using custom header obfuscation configuration.\n\n\u003e `Make sure your header file look like the below JSON` :\n\n```\n{\n  \"header\": {\n    \"type\": \"http\",\n    \"response\": {\n      \"version\": \"1.1\",\n      \"status\": \"200\",\n      \"reason\": \"OK\",\n      \"headers\": {\n        \"Content-Type\": [\n          \"application/octet-stream\",\n          \"application/x-msdownload\",\n          \"text/html\",\n          \"application/x-shockwave-flash\"\n        ],\n        \"Transfer-Encoding\": [\"chunked\"],\n        \"Connection\": [\"keep-alive\"],\n        \"Pragma\": \"no-cache\"\n      }\n    }\n  }\n}\n```\n\n\u003e header argument is useful when needing another http request configuration you can pass your http request configuration with this option.\n\u003e\n\u003e --header request.json\n\n\u003e Visit below site for HTTPRequest Object :\n\u003e https://www.v2ray.com/en/configuration/transport/tcp.html#httprequestobject\n\n`linkname` for changing linkname after generating configuration.\n\n#### Link formats :\n\n##### `VMess` :\n\n```json\nvmess://{\"add\":\"ip / domain \",\"aid\":\"alterid\",\"host\":\"\",\"id\":\"random-uuid\",\"net\":\"ws\",\"path\":\"websocket-path\",\"port\":\"80\",\"ps\":\"linkname\",\"tls\":\"\",\"type\":\"none\",\"v\":\"2\" }\n```\n\n##### `VLess` :\n\n```json\nvless://random-uuid@ip:port?path=websocketpath\u0026security=type\u0026encryption=none\u0026type=ws#linkname\n```\n\n##### `Trojan` :\n\n```json\ntrojan://password@ip:port?allowInsecure=insecure\u0026security=\u0026type=networkstream#linkname\n```\n\n##### `ShadowSocks` :\n\n```json\nss://shadowsocks-security-method:random-uuid@domain/ip :port\n```\n\n## Client Side\n\nafter generating the configuration with desired protocol client-side configuration is also generated as well\n\nyou can use client-side configuration directly with xray-core or v2ray-core\n\n`security` security method for client-side configuration.\n\nList of security methods :\n\n- `aes-128-gcm`\n- `chacha20-poly1305`\n- `auto`\n- `none`\n- `zero`\n\n`csocks` client-side SOCKS port . default: [10808]\n\n`chttp` client-side HTTP port . default: [10809]\n\n`qrcode` Generate QRCode for generated link.\n\n\u003e if you want to import your configuration with qrcode use this argument.\n\n## ShadowSocks\n\nshadowsocks are loaded with xray docker container and it uses tcp stream for passing traffic\n\n`sspass` set password for shadowsocks configuration file. by default, it uses a random password\n\n`ssmethod` Set cipher method for ShadowSocks . default cipher method is `2022-blake3-chacha20-poly1305` to provide better security hence it's only usable in xray-core. for using shadowsocks with v2ray core use one of the below cipher methods :\n\nV2Ray Cipher methods :\n\n- `2022-blake3-chacha20-poly1305`\n- `2022-blake3-aes-256-gcm`\n- `2022-blake3-aes-128-gcm`\n\nXRay Cipher methods :\n\n- `2022-blake3-chacha20-poly1305`\n- `2022-blake3-aes-256-gcm`\n- `2022-blake3-aes-128-gcm`\n- `xchacha20-ietf-poly1305`\n\n---\n\n## Parsing Configuration\n\nfor parsing existed configuration or decoding vmess url use below options :\n\n`parse` for parsing encoded link. supported formats are [vmess://,ss://]\n\n`parseconfig` for reading the configuration file and parsing information\n\n\u003e `--parseconfig config.json` will show the information of the configuration and generate a QR code for that\n\n---\n\n## **Block List**\n\nBlock lists are files that can be used in V2Ray clients that allow users to block or direct individual connections. These lists can be used to blacklist specific IP addresses or domains, or to whitelist trusted ones.\n\nIn some countries, such as Iran, authorities actively try to block access to VPN services by monitoring requests sent from foreign IP addresses to local servers. When such requests are detected, the associated IP addresses are added to a blacklist, effectively blocking access to VPNs. As a result, users in these countries may need to disable their VPN connection in order to access local websites without issue. Block lists can help circumvent these restrictions by allowing users to selectively block or redirect certain connections, thereby avoiding detection by authorities.\n\nThis files are avaliable under [geodata][geodata] directory\n\n### Block List Sources\n\nThe ads list is provided by the [PersianBlocker](https://github.com/MasterKia/PersianBlocker) list.\n\nThe iraninan CIDR is provided by the [IP2Location](\u003chttps://lite.ip2location.com/iran-(islamic-republic-of)-ip-address-ranges?lang=en_US\u003e) site.\n\n---\n\n## DonateMe\n\nIf this Project helped you, you can also help me by donation\n\n### ![tron-button] \u0026nbsp; TTTo7aasobgqH5pKouCJfmPYn2KLed2RA3\n\n### ![bitcoin-button] \u0026nbsp; bc1qgdav05s04qx99mdveuvdt76jauttcwdq687pc8\n\n### ![ethereum-button] \u0026nbsp; 0xD17dF52790f5D6Bf0b29151c7ABC4FFC4056f937\n\n### ![tether-button] \u0026nbsp; 0xD17dF52790f5D6Bf0b29151c7ABC4FFC4056f937\n\n## License\n\nLicensed under the [GPL-3][license] license.\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n\n[tron-button]: https://img.shields.io/badge/TRX-Tron-ff69b4\n[tether-button]: https://img.shields.io/badge/ERC20-Tether-purple\n[bitcoin-button]: https://img.shields.io/badge/BTC-Bitcoin-orange\n[ethereum-button]: https://img.shields.io/badge/ETH-Ethereum-blue\n[contributors-shield]: https://img.shields.io/github/contributors/SonyaCore/V2RayGen?style=flat\n[contributors-url]: https://github.com/SonyaCore/V2RayGen/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/SonyaCore/V2RayGen?style=flat\n[forks-url]: https://github.com/SonyaCore/V2RayGen/network/members\n[stars-shield]: https://img.shields.io/github/stars/SonyaCore/V2RayGen?style=flat\n[stars-url]: https://github.com/SonyaCore/V2RayGen/stargazers\n[issues-shield]: https://img.shields.io/github/issues/SonyaCore/V2RayGen?style=flat\n[issues-url]: https://github.com/SonyaCore/V2RayGen/issues\n[telegram-shield]: https://img.shields.io/badge/Telegram-blue.svg?style=flat\u0026logo=telegram\n[telegram-url]: https://t.me/ReiNotes\n[license]: LICENCE\n[geodata]: geodata\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonyacore%2Fv2raygen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonyacore%2Fv2raygen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonyacore%2Fv2raygen/lists"}