This repository contains V2Ray-based solutions for bypassing firewalls in restricted networks where direct access to upstream servers (servers with free internet access) is unavailable.
The "V2Ray Upsream and Relay Servers" solution offers high stability and speed (depends on the network speeds of the relay and upstream servers).
The solution uses V2Ray on the upstream server, using the Shadowsocks protocol for communication with the relay server. The relay server provides Shadowsocks protocol for users, in addition to Socks5 and HTTP protocols for the relay server's own use.
The Shadowsocks protocol is used because it operates on layer 4, making it very fast. Additionally, there are many user-friendly client applications that support this protocol.
You will need two types of servers:
- Upstream Server: A server with access to the free internet, likely located in a foreign data center.
- Relay Server: A server that can connect to the upstream server and is accessible to users, likely located in the same region as the users.
The flow of V2Ray Upsream and Relay Servers:
Users <-> Relay Server <-> Upstream Server <-> Internet
Step 1: Setup Upstream Server
- Install Docker and Docker-compose (Official Documanetation).
- Run
git clone https://github.com/miladrahimi/v2ray-docker-compose.git
to download this repository. - Run
cd v2ray-docker-compose/v2ray-upstream-server
to change the directory. - Replace
<UPSTREAM-PASSWORD>
inv2ray.json
with a Shadowsocks password likeFR33DoM
. - Run
docker compose up -d
. - (Optional) Run
./../utils/bbr.sh
to setup BBR and speed up the server network.
Step 2: Setup Relay Server
- Install Docker and Docker-compose (Official Documanetation).
- Run
git clone https://github.com/miladrahimi/v2ray-docker-compose.git
to download this repository. - Run
cd v2ray-docker-compose/v2ray-relay-server
to change the directory. - Replace the following variables in
v2ray.json
with appropriate values.<RELAY-PASSWORD>
: A password for Shadowsocks users likeFR33DoM
.<UPSTREAM-IP>
: The upstream server IP address (like13.13.13.13
).<UPSTREAM-PASSWORD>
: The Shadowsocks password from the upstream server in the previous step.
- Run
docker compose up -d
. - Run
./clients.py
to generate client configurations and links. - (Optional) Run
./../utils/bbr.sh
to setup BBR and speed up the server network.
The "V2Ray Behind CDN" solution is recommended only if you don't have relay server to implement other solutions.
This solution provides VMess protocol over Websockets + TLS + CDN (Read more) for users.
In this solution, you need an upstream server and a domain integrated with a CDN service:
- Upstream Server: A server with access to the free internet, likely located in a foreign data center.
- CDN Service: A Content Delivery Network service like Cloudflare and ArvanCloud.
The flow of V2Ray Behind CDN:
Users <-> CDN <-> Upstream Server <-> Internet
Follow these steps to set up V2Ray, Caddy (Web server) and CDN:
- In the CDN panel, create an
A
record for the server IP with the proxy disabled. - Install Docker and Docker-compose (Official Documanetation).
- Run
git clone https://github.com/miladrahimi/v2ray-docker-compose.git
to download this repository. - Run
cd v2ray-docker-compose/v2ray-caddy-cdn
to change the directory. - Run
cat /proc/sys/kernel/random/uuid
to generate a UUID. - Replace
<UPSTREAM-UUID>
inv2ray.json
with the generated UUID. - Replace
<EXAMPLE.COM>
incaddy/Caddyfile
with your domain/subdomain. - Run
docker compose up -d
. - Visit your domain/subdomain in your web browser. Wait until the homepage is loaded.
- In the CDN panel, enable the proxy option for the record created during the first step.
- Run
./vmess.py
to generate client configuration link. - (Optional) Run
./../utils/bbr.sh
to setup BBR and speed up the server network.
Notes
- If you prefer using NGINX as your web server, please refer to V2Ray Behind CDN and NGINX.
- Some CDN services do not provide unlimited traffic with their free plans. Please check CDN Free Plans.
- You can skip step 10 and keep the proxy off, but this could lead to quicker server blocking.
The "V2Ray as Relay for Outline" solution is stable, fast, easy to set up, and highly recommended.
It allows you to use Outline proxy tools to support the Shadowsocks protocol and provides the user-friendly Outline Client application for users, along with the Outline Manager app for setting up servers, creating and managing users, and tracking their traffic.
Read more in the Outline Bridge Server repository.
This is the list of recommended applications for Shadowsocks protocol:
- Outline for all platforms
- ShadowsocksX-NG for macOS
- shadowsocks-libev for Linux
- shadowsocks-windows
- shadowsocks-android
- ShadowLink for iOS
This is the list of recommended applications for VMess protocol:
- Nekoray for macOS, Windows, and Linux
- FoXray for macOS, iOS, and Android
- V2Box for macOS and iOS
- V2Box for Android
- ShadowLink for iOS
- v2rayNG for Android
- v2rayN for Windows
Moved to HTTP & SOCKS Protocols.