V2RayGen / XRayGen is a fully automated script that helps you to set up your own Xray server in the fastest time.
For running this script, you must have docker, docker-compose and python3 on your server but this script installs docker
& docker-compose
if your server doesn't have docker and runs xray-core automatically
use sudo if your current user is not in the docker group or you don't have docker installed
XRayGen
uses docker to pull XRay image from the docker registry and after that, it generates a configuration file to start XRay container.
it also creates a client side configuration file so you can use that with xray-core or v2ray-core.
There is also XRayAgent
for User Management on XRay Configuration which can be used for CRUD operations.
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 - -h
You can use one of the following protocols for installation and change its settings according to your needs.
Protoctol | Argument |
---|---|
VMESS | --vmess , -wm |
VMESS + TLS | --vmess --tls , -vmtls |
VLESS + TLS | --vless , -vl |
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess
OR
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py --output V2RayGen.py
sudo python3 V2RayGen.py --vmess
after installation use the provided link to your client or use the client-side json configuration with xray-core or v2ray-core
if your server is on the domain after importing the link to your v2ray client simply change the IP to your domain or subdomain
Setup XRAY / ShadowSocks :
VLESS :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vless
VMESS + TLS with blocking option :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tls --block
VMESS + Changing client-side HTTP and SOCKS port :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --chttp 4020 --csocks 8080
VMESS + HTTP Network Stream :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --http
VMESS + TCP Network Stream :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tcp
VMESS + TCP Network Stream + TLS and QRCode :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vmess --tcp --tls --qrcode
VLESS + Using Google DNS :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --vless --dns google
ShadowSocks + adding shadowsocks port to server :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | sudo python3 - --shadowsocks --firewall
Parsing Configuration :
Parse & reading Configuration file :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 - --parseconfig config.json
Parse URL and read information :
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/V2RayGen.py | python3 - --parse vmess://eyJhZGQiOiIxMjcuMC4wLjEiLCJhaWQiOiIwIiwiaG9zdCI6IiIsImlkIjoiM2JlNjE2NzktOGQzOC00ZWJiLWJjOGItMTQ4ZjE0ZWY5ZTc3IiwibmV0Ijoid3MiLCJwYXRoIjoiL2dyYXBocWwiLCJwb3J0IjoiNDQzIiwicHMiOiJ4cmF5IiwidGxzIjoidGxzIiwidHlwZSI6Im5vbmUiLCJ2IjoiMiIgfQ==
XRayAgent is a Simple User Management for XRay Configuration
XRayAgent takes user input so you have to download that to your server and then running it
curl https://raw.githubusercontent.com/SonyaCore/V2RayGen/main/XRayAgent.py --output XRayAgent.py
python3 XRayAgent.py
By default it loads
config.json
for loading configuration
For loading other configuration simply enter the name of the configuration after XRayAgent.py :
python3 XRayAgent.py config.json
add, adduser Adding user
update, updateuser Update existing user with their index ID
del, deluser Delete existing user with ther index ID
users, listusers List of users
deliptables, deleteiptables Delete rules on server-side port
climit , conlimit Add IP limitations on server-side port
p, port Change server side port
h, help Get help
v, version Get version of program
q, quit Exit program
after adding an user a index will be created for that user for example :
Index : 0 {'id': '25ad6df8-9a54-4f6e-8c44-d5685359a7ce', 'level': 0, 'email': 'example@example.com'}
Index : 1 {'id': '62bf2d5d-766b-4281-963a-544449a26b4f', 'level': 0, 'email': 'cLkx4WC0@protonmail.com'}
and now you can update that user with ther index ID :
cmd > : update 1
Index 1 Selected
Leave the section empty if you don't want to modify that section
New Email : test@gmail.com
New ID : 62bf2d5d-766b-4281-963a-544449a26b4f
Index 1 Updated
vless://62bf2d5d-766b-4281-963a-544449a26b4f@127.0.0.1:443?path=/graphql&security=tls&encryption=none&type=ws#xray
Use Index ID for
update
,del
For Showing list of Users and their Indexs use
users
orlistusers
command
using climit
or conlimit
limits the total connection ips on server side port
for deleting the all rules on server side port use deliptables
or deleteiptables
you can change server-side configuration with below options :
tls
Using TLS in specified protocol
http
Using Http insted of Websocket
linkname
for changing linkname after generating configuration.
port
for changing configuration port.
dns
for using custom dns instead system's default dns configuration.
wspath
for changing default WebSocket path configuration.
uuid
for using custom uuid configuration.
id
custom alterID.
loglevel
using another loglevel for configuration insted of [warning].
header
for using custom header configuration.
block
for adding blocking Bittorrent and Ads.
after generating the configuration with desired protocol client-side configuration is also generated as well
you can use client-side configuration directly with xray-core or v2ray-core
security
security method for client-side configuration.
csocks
client-side SOCKS port . default: [2080]
chttp
client-side HTTP port . default: [2081]
qrcode
Generate QRCode for generated link.
for parsing existed configuration or decoding vmess url use below options :
parse
for parsing encoded link. supported formats are [vmess://,ss://]
parseconfig
for reading the configuration file and parsing information
Supported DNS providers:
use
--dns
to set one of below dns's.
DNS |
---|
cloudflare |
opendns |
quad9 |
adguard |
use
--outband
to set one of below protocols.
Outband Protocols |
---|
Freedom |
BlackHole |
Freedom + BlackHole |
Visit below site for HTTPRequest Object : https://www.v2ray.com/en/configuration/transport/tcp.html#httprequestobject
Make sure your header file look like the below JSON
:
{
"header": {
"type": "http",
"response": {
"version": "1.1",
"status": "200",
"reason": "OK",
"headers": {
"Content-Type": [
"application/octet-stream",
"application/x-msdownload",
"text/html",
"application/x-shockwave-flash"
],
"Transfer-Encoding": ["chunked"],
"Connection": ["keep-alive"],
"Pragma": "no-cache"
}
}
}
}
vmess://{"add":"ip / domain ","aid":"alterid","host":"","id":"random-uuid","net":"ws","path":"websocket-path","port":"80","ps":"linkname","tls":"","type":"none","v":"2" }
vless://random-uuid@ip:port?path=websocketpath&security=type&encryption=none&type=ws#linkname
ss://shadowsocks-security-method:random-uuid@domain/ip :port
If this Project helped you, you can also help me by donation
Licensed under the GPL-3 license.