This script provides you with the following methods to create a tunnel between a relay server and your main server.
1. IP-Tables
2. GOST
3. Dokodemo-Door
4. HA-Proxy
5. Socat
In order to create tunnels on your relay server, you just need to run the following command.
bash -c "$(curl -L https://raw.githubusercontent.com/hiddify/hiddify-relay/main/install.sh)"
Click for IP-Tables Tunnel details
According to the 1st picture above, choose number `1` and enter the `IP-Tables tunnel` to manage it.1. Install iptables rules
After selecting the number 1
in the IP-Tables Menu
, it asks you to enter the IP address of the main server and press Enter
button to activate the tunnel on ports 443
and 80
.
2. Check ports in use
This option shows you the ports used in the IPTables tunnel.
3. Uninstall iptables rules
This option clears all rules created for the tunnel and all other rules.
[!NOTE] Be careful that if you have created special rules next to the tunnel manually, they will be deleted with this command.
4. Back to Main Menu
In order to go back to the main menu press 4
.
Click for GOST Tunnel details
According to the 1st picture above, choose number `2` and enter the `GOST Tunnel` to manage it.1. Install GOST
- After choosing number
1
, wait until the tunnel is installed. - After the installation is complete, in the first step, you must enter the desired port for the tunnel and then press Enter.
- In the next step, enter the domain or subdomain of your main server, then press
Enter
. Wait until the tunnel should be started. - After starting, the message
Gost tunnel is installed and activated
will be displayed in green.
2. Check GOST Port and Status
After selecting option 2
, the ports used in the tunnel and the status of the tunnel will be displayed on the screen.
3. Add Another Port and Domain
- You can use this option if you want to tunnel from the relay server to several outside servers.
- After selecting the number
3
, you must enter the new port, press theEnter
button, then enter the domain of the main server and press theEnter
button. - You can enter option number
2
to ensure that the previous steps are correctly done and to check the used ports and to see if the tunnel is activated.
4. Uninstall GOST
This option will remove the GOST tunnel from your relay server.
5. Back to Main Menu
In order to go back to the main menu press 5
.
Click for Dokodemo-door Tunnel details
According to the 1st picture above, choose number `3` and enter the `Dekodemo-door Tunnel` to manage it.1. Install Xray and add inbound
- After selecting number
1
in the Dokodemo-door tunnel menu, wait for the Xray kernel to be installed on the relay server. - After installation, enter the
IP address
or thedomain
of the main server in theaddress section
. - in the next section enter the desired port of the tunnel (recommended: 443,80), then press the
Enter
button. - The message
Inbound added and tunnel started
will be displayed.
2. Check Xray Service Status
After selecting option 2
, the ports used in the tunnel and the status of the tunnel will be displayed on the screen.
3. Add another inbound
- You can use option
3
in the Dokodemo-door tunnel menu to create another inbound connection and connect your relay server to several external servers. - After selecting option
3
, in thenew address section
, enter theIP address
or thedomain
of your new server, then pressEnter
. - Next step, enter the new port in the
new port field
and pressEnter
button. - The message
Another inbound added
will be displayed. - You can enter option number
2
to ensure that the previous steps are correctly done and to check the used ports and to see if the tunnel is activated.
4. Uninstall Xray and Dokodemo-Door tunnel
Choose this option to remove Dokodemo-door tunnel and Xray core from your relay server.
5. Back to Main Menu
In order to go back to the main menu press 5
.
Click for HA-Proxy Tunnel details
According to the 1st picture above, choose number `4` and enter the `HA-Proxy Tunnel` to manage it.1. Install HA-Proxy
- After selecting option
1
, wait for the installation of the HA-Proxy package. - After installation, in the
Relay port section
, enter the desired port in your relay server (recommended port 443) - Then enter the IP address of your main server in the Enter Main-Server IP field.
- Then, in the Enter Main-Server Port section, enter the port freed on your main and external server (e.g. by default, Hiddify Manager uses port 443, and it is recommended to use this port).
- After the correct operation, the message
HA-Proxy tunnel is installed and activated.
will be displayed on the screen.
2. Check HA-Proxy Ports and Status
After selecting option 2
, the ports used in the tunnel and the status of the tunnel will be displayed on the screen.
3. Uninstall HA-Proxy
Use this option to remove HA-Proxy tunnel from the relay server.
4. Back to Main Menu
In order to go back to the main menu press 4
.
Click for Socat Tunnel details
According to the 1st picture above, choose number `5` and enter the `Socat Tunnel` to manage it.1. Install Socat And Setup Tunnel Service
- After selecting option
1
, wait for the installation of the Socat package. - Then enter the
IP
andPort
of main server. - After the correct operation, the message
Socat tunnel is installed and activated.
will be displayed on the screen.
2. Check Socat Port
After selecting option 2
, the ports used in the tunnel will be displayed on the screen.
3. Uninstall Socat And Remove Tunnel Service
Use this option to remove Socat tunnel from the relay server.
4. Back To Main Menu
In order to go back to the main menu press 4
.
Note
If you want to add the relay server to Hiddify Manager
please read this article.
We appreciate all people who are participating in this project. Some people here and many many more outside of Github. It means a lot to us. ♥
Made with Contrib.Rocks