Xray Reality with send configuration in the telegram channel every day.This project send Xray Reality configuration to your channel base on schedule.
Ubuntu 22.04
for more detail please read other parts.
- please run these command one by one.
- I am extremely recommend to change port 22 into another port.
echo "Port 9001" >> /etc/ssh/sshd_config
systemctl restart sshd
service ssh restart
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
- please run these command one by one.
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/install.sh
sudo chmod +x /root/xray-configuration/install.sh
bash /root/xray-configuration/install.sh
if you need modify the setting.json file
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443,2087],
\"domains\": [
\"ftp.debian.org\",
\"discord.com\"
],
\"bot_token\" : \"627434621931:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b\",
\"chat_id\" : \"-1002343276432\",
\"donate_url\" : \"\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"Sarina_Esmailzadeh\",
\"send_vnstat\" : false,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
after change the cronjob time, you need to save it. easy set the time
crontab -e
Run the command.
cd /root/xray-configuration
./xray-telegram
We have two configuration options. Get bot token and chat id from your telegram account and telegram bot father.
get bot token from BotFather
get chat id from Find Channel id
Fill the configuration inside the setting.json.
examples of configuration bot_token is "2XXXXXXXX1:AXXXX_9XXXXXXXXXXXXXXXN-RXXXXXs" chat_id is "-10000000000000"
Setting file is located in /root/xray-configuration/settings.json and you can easily modify settings. After changing settings, it necessary to run again ./xray-configuration
after changing.
Edit this setting file base on your needs.
ports
are the ports that you want to use in your server.
domains
are the domains that you want to use in your SNI.
bot_token
is the bot token that you get from the bot father.
chat_id
is the chat id that you get from the channel.
donate_url
is the url that you want to send your configuration.
dynamic_subscription
is the boolean value that you want to have dynamic subscribe link like subscribe.txt
or dynamic ones like subscribe.122.txt
channel_name
is the channel name that you want to send your configuration. You can choose what ever your want. System didn't check it.
send_vnstat
is the boolean value that you want to send ( Bandwidth usage ) vnstat information to the channel.
list_of_subscriptions
is list of other services that you want to aggregate . if you don't need it leave it without data aggregate_subscriptions : []
send_configuration
is send configuration to the channel. you can choose all
or first
or none
send_subscriptions
is send subscription to the channel. you can choose true
or false
grpc
is boolean variable, if the value is true
system set GRPC configuration.
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443,2087],
\"domains\": [
\"ftp.debian.org\",
\"discord.com\"
],
\"bot_token\" : \"627434621931:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b\",
\"chat_id\" : \"-1002343276432\",
\"donate_url\" : \"https://where_ever_you_want.site\",
\"dynamic_subscription\" : true,
\"channel_name\" : \"Sarina_Esmailzadeh\",
\"send_vnstat\" : true,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
Another Method for modify setting.json
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/setting.json
nano /root/xray-configuration/setting.json
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/setting.json
Instead of creating the setting.json file, you can also use the following command to create the file and fill it with the default values.
Using Online Tool : Open a JSON Formatter tool from the link below
https://jsonformatter.org
or
https://codebeautify.org/jsonviewer
or
https://json-gui.esstudio.site/
Copy and Paste the JSON Data, which is mentioned in Option 1 in the Input tool of the online tool . after making json format, write it with nano in setting.json
nano /root/xray-configuration/setting.json
For check your json file you can use below command line.
cat /root/xray-configuration/setting.json
You have to see below result.
{
"ports": [443, 22 ],
"domains": [
"www.datadoghq.com",
"000webhost.ir"
],
"bot_token" : "627444321931:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b",
"chat_id" : "-1003342276432",
"donate_url" : "",
"dynamic_subscription" : false,
"channel_name" : "Sarina_Esmailzadeh",
"send_vnstat" : true,
"aggregate_subscriptions" : [],
"send_configuration" : "first",
"send_subscriptions" : true,
"grpc" : [true, false]
}
If you don't see setting.json file, you can create it with below command line.
You can also edit your file with nano editor.
How To Make and Edit Files With Nano
Nano for Text Editing in Ubuntu
Learn JSON in 10 Minutes
rm -rf /root/xray-configuration/setting*
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/setting.json
nano setting.json
And then modify your json file.
If these method didn't work for use FileZilla to upload file directly to the server. How to upload files to your web server using FileZilla
In this case you need to connect server with subscription only.
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [8585, 2054],
\"domains\": [
\"aws.amazon.com\",
\"eset.com\",
],
\"bot_token\" : \"\",
\"chat_id\" : \"\",
\"donate_url\" : \"\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"sarina\",
\"send_vnstat\" : false,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"none\",
\"send_subscriptions\" : false,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
Check send the new configuration to telegram channel.
./xray-configuration
after command execution the configuration send to your telegram channel.
You can buy VPS server and donate your server to the Yebekhe. It means that you can share your configuration with other people,And help to other people to have free internet. Finally, you can help Women,Life,Freedom movement.
You can also send your automatically to the yebekhe server or what URL you wants. just fill donate_url
with your desirable address.
My sister-in-law project is Yebekhe
Don't need to have telegram channel.
Don't need to have telegram bot.
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443, 2095 ],
\"domains\": [
\"ftp.debian.org\",
\"discord.com\"
],
\"bot_token\" : \"\",
\"chat_id\" : \"\",
\"donate_url\" : \"yebekhe\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"sarina\",
\"send_vnstat\" : false,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
After install that explain in upper section. you can change scheduler time in the cronjob.
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/install.json
for edit cronjob use these command:
crontab -e
put “At minute 50 past every 2nd hour.” schedule for update the configuration.
28 */2 * * *
You can change the cronjob time in the cronjob.sh file. easy set the time
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443, 22 ],
\"domains\": [
\"ftp.debian.org\",
\"discord.com\"
],
\"bot_token\" : \"627344321931:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b\",
\"chat_id\" : \"-1003342176532\",
\"donate_url\" : \"yebekhe\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"Sarina\",
\"send_vnstat\" : true,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
Just write stop
in donate_url
part of the configuration section. And run ./xray-configuration
Then remove the stop
form your configuration.
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443, 22],
\"domains\": [
\"ftp.debian.org\",
\"discord.com\"
],
\"bot_token\" : \"627444321231:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b\",
\"chat_id\" : \"-1003342276432\",
\"donate_url\" : \"stop\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"Sarina\",
\"send_vnstat\" : true,
\"aggregate_subscriptions\" : [],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
Imagine you have three servers in different zones. And you want to aggregated all of these link and make one single link.
for example:
https://1.22.33.444/subscribe.txt
https://2.22.33.444/subscribe.txt
https://3.22.33.444/subscribe.txt
now we make one single endpoint for you by this future:
We will put this server subscription in front of these links as default values:
Final result will be in below address
https://ip-this-server/aggregate.txt
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
touch /root/xray-configuration/setting.json
echo "{
\"ports\": [443, 22],
\"domains\": [
\"cdn.discordapp.com\",
\"www.theverge.com\"
],
\"bot_token\" : \"627444321231:bga9g_13IQBuAcDb3DSemBceracA-KDDA3b\",
\"chat_id\" : \"-1003342276432\",
\"donate_url\" : \"\",
\"dynamic_subscription\" : false,
\"channel_name\" : \"Sarina\",
\"send_vnstat\" : true,
\"aggregate_subscriptions\" : [ \"https://1.22.33.444/subscribe.txt\" , \"https://2.22.33.444/subscribe.txt\" , \"https://3.22.33.444/subscribe.txt\"],
\"send_configuration\" : \"first\",
\"send_subscriptions\" : true,
\"grpc\" : [true, false]
}"> /root/xray-configuration/setting.json
If you want to aggregate subscriptions with serverless system better used below repository. V2Hub
Show errors of cron jobs
cat /root/xray-configuration/cronjob.log
Reinstall the first time install the Xray
cd /root
mkdir /root/xray-configuration
cd /root/xray-configuration
rm -rf /root/xray-configuration/install.sh*
wget https://raw.githubusercontent.com/majidrezarahnavard/xray-reality-daily-telegram/main/install.json
sudo chmod +x /root/xray-configuration/install.sh
bash /root/xray-configuration/install.sh
Check Xray version
xray version
Check status of xray
systemctl status xray
Restart Xray service
systemctl restart xray
Check logs of Xray
journalctl -u xray.service
systemctl status xray
Check volume of disk usage in server
df -h
ls -laht /var/log
echo "" > /var/log/kern.log
echo "" > /var/log/syslog
echo "" > /var/log/syslog.1
service syslog restart
journalctl --vacuum-size=50M
check the website
https://ip
If you had firewall on your server, you need to open the port that you want to use.
sudo ufw status
Linux Security - UFW Complete Guide
If vnstat didn't work properly, you need to reset the database.
vnstat -D
Or Another solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:
vnstatd -n -s
Apart from that, I also needed to apply
sudo chown -R vnstat:vnstat /var/lib/vnstat
you need to run these commands manually:
# Stop and disable xray service
systemctl stop xray
systemctl disable xray
# Remove files
rm /etc/systemd/system/xray.service
rm /root/xray-configuration/reality.json
rm /root/xray-configuration/xray
rm /root/xray-configuration/subscribe.*
rm -rf /var/www/hml/subscribe.*
rm /root/xray-configuration/key_pair.txt
rm /root/xray-configuration/xray-telegram
rm /root/xray-configuration/install.sh
rm /root/xray-configuration/reinstall.sh
rm /root/xray-configuration/make_subscribe.sh
And if you want delete setting.json
rm /root/xray-configuration/setting.json
df -h
ls -laht /var/log
echo "" > /var/log/kern.log
echo "" > /var/log/syslog
echo "" > /var/log/syslog.1
service syslog restart
journalctl --vacuum-size=50M
You can find the best SNI with the following github repository:
TLS Checker
List of servers to test speedtest-cli
scan reality address in Persian
Reality - TLS - Scanner
Cron job is the time scheduler for run the script automatically. after two days new configuration will send to your channel.
see the cronjob list
crontab -l
result:
for edit cronjob use these command
crontab -e
show log of cronjob cat cronjob.log
you can change the cronjob time in the cronjob.sh file. easy set the time
for example use 30 9 * * 6
for the “At 09:30 on Saturday.”
This part for fake html and give url link to members of the Telegram channel.
you can share https://ip/subscribe.txt
to members of the Telegram channel.
Dynamic subscribe has different format like this https://ip/subscribe.122.txt
And Also you can use https://ip
for fake html.
for build go file use below command line:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o xray-telegram